public class BitOutputStream extends java.io.OutputStream implements BitConstants
Warning: The write(byte[]) and write(byte[], int, int)
methods of OutputStream will not work appropriately with any
bit size > 8 bits.
BIT_MASKS| Constructor and Description |
|---|
BitOutputStream(java.io.OutputStream os,
int startingNumberOfBits)
Create a BitOutpuStream wrapping the given
OutputStream
and writing the number of bits specified. |
| Modifier and Type | Method and Description |
|---|---|
void |
clearRemainingBitsOfData()
When shifting from buffer to buffer, this OutputStream also should be reset.
|
void |
close()
Close the output stream and write any remaining byte to the output.
|
int |
getBitMask()
Answer with the current bit mask for the current bit size.
|
void |
increaseRequestedNumberOfBits()
Increase the requested number of bits by one.
|
void |
setRequestedNumberOfBits(int numberOfBits)
Set the number of bits to be write with each call to
write(int). |
void |
write(int b)
Write the number of bits to the wrapped OutputStream.
|
public BitOutputStream(java.io.OutputStream os,
int startingNumberOfBits)
OutputStream
and writing the number of bits specified.public void setRequestedNumberOfBits(int numberOfBits)
write(int).public void increaseRequestedNumberOfBits()
public int getBitMask()
public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void clearRemainingBitsOfData()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException