public class BZip2BitOutputStream extends Object
An OutputStream wrapper that allows the writing of single bit booleans, unary numbers, bit strings of arbitrary length (up to 24 bits), and bit aligned 32-bit integers. A single byte at a time is written to the wrapped stream when sufficient bits have been accumulated
Constructor and Description |
---|
BZip2BitOutputStream(OutputStream outputStream) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Writes any remaining bits to the output stream, zero padding to a whole byte as required
|
void |
writeBits(int count,
int value)
Writes up to 24 bits to the wrapped output stream
|
void |
writeBoolean(boolean value)
Writes a single bit to the wrapped output stream
|
void |
writeInteger(int value)
Writes an integer as 32 bits of output
|
void |
writeUnary(int value)
Writes a zero-terminated unary number to the wrapped output stream
|
public BZip2BitOutputStream(OutputStream outputStream)
outputStream
- The OutputStream to wrappublic void writeBoolean(boolean value) throws IOException
value
- The bit to writeIOException
- if an error occurs writing to the streampublic void writeUnary(int value) throws IOException
value
- The number to write (must be non-negative)IOException
- if an error occurs writing to the streampublic void writeBits(int count, int value) throws IOException
count
- The number of bits to write (maximum 24)value
- The bits to writeIOException
- if an error occurs writing to the streampublic void writeInteger(int value) throws IOException
value
- The integer to writeIOException
- if an error occurs writing to the streampublic void flush() throws IOException
IOException
- if an error occurs writing to the streamCopyright © 2018. All rights reserved.