final class Bzip2BitWriter
extends java.lang.Object
ByteBuf
when sufficient bits have been accumulated.Modifier and Type | Field and Description |
---|---|
private long |
bitBuffer
A buffer of bits waiting to be written to the output stream.
|
private int |
bitCount
The number of bits currently buffered in
bitBuffer . |
Constructor and Description |
---|
Bzip2BitWriter() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
flush(ByteBuf out)
Writes any remaining bits to the output
ByteBuf ,
zero padding to a whole byte as required. |
(package private) void |
writeBits(ByteBuf out,
int count,
long value)
Writes up to 32 bits to the output
ByteBuf . |
(package private) void |
writeBoolean(ByteBuf out,
boolean value)
Writes a single bit to the output
ByteBuf . |
(package private) void |
writeInt(ByteBuf out,
int value)
Writes an integer as 32 bits to the output
ByteBuf . |
(package private) void |
writeUnary(ByteBuf out,
int value)
Writes a zero-terminated unary number to the output
ByteBuf . |
private long bitBuffer
private int bitCount
bitBuffer
.void writeBits(ByteBuf out, int count, long value)
ByteBuf
.count
- The number of bits to write (maximum 32
as a size of int
)value
- The bits to writevoid writeBoolean(ByteBuf out, boolean value)
ByteBuf
.value
- The bit to writevoid writeUnary(ByteBuf out, int value)
ByteBuf
.
Example of the output for value = 6: 1111110
value
- The number of 1
to writevoid writeInt(ByteBuf out, int value)
ByteBuf
.value
- The integer to write