public final class BitOutputStream
extends java.lang.Object
implements java.lang.AutoCloseable
| Constructor and Description |
|---|
BitOutputStream(java.io.OutputStream out)
Constructs a BitOutputStream using the given OutputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream and the underlying OutputStream.
|
void |
write(int bit)
Writes a bit to the stream.
|
public BitOutputStream(java.io.OutputStream out)
out - the backing OutputStreamjava.lang.NullPointerException - if the outputStream stream is nullpublic void write(int bit)
throws java.io.IOException
bit - the bit to write, which must be 0 or 1java.io.IOException - if file cannot be readpublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException - if an I/O exception occurred