Constructor and Description |
---|
BitOutputStream(Stream out)
Use an OutputStream to produce a BitWriter.
|
Modifier and Type | Method and Description |
---|---|
long |
nrBits()
Returns the number of bits that have been written to this
bitOutputStream.
|
void |
one()
Write a 1 bit.
|
void |
pad(int width)
Pad the rest of the block with zeros and flush.
|
void |
write(int bits,
int width)
Write some bits.
|
void |
zero()
Write a 0 bit.
|
public BitOutputStream(Stream out)
out
- An Output Streampublic long nrBits()
public void one() throws IOException
one
in interface BitWriter
IOException
public void pad(int width) throws IOException
pad
in interface BitWriter
width
- The size of the block to pad in bits.
This will typically be 8, 16, 32, 64, 128, 256, etc.IOException
public void write(int bits, int width) throws IOException
write
in interface BitWriter
bits
- The bits to be written.width
- The number of bits to write. (0..32)IOException
public void zero() throws IOException
zero
in interface BitWriter
IOException