Class Bzip2BitWriter
- java.lang.Object
-
- io.netty.handler.codec.compression.Bzip2BitWriter
-
final class Bzip2BitWriter extends java.lang.ObjectA bit writer that allows the writing of single bit booleans, unary numbers, bit strings of arbitrary length (up to 32 bits), and bit aligned 32-bit integers. A single byte at a time is written to theByteBufwhen sufficient bits have been accumulated.
-
-
Constructor Summary
Constructors Constructor Description Bzip2BitWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidflush(ByteBuf out)Writes any remaining bits to the outputByteBuf, zero padding to a whole byte as required.(package private) voidwriteBits(ByteBuf out, int count, long value)Writes up to 32 bits to the outputByteBuf.(package private) voidwriteBoolean(ByteBuf out, boolean value)Writes a single bit to the outputByteBuf.(package private) voidwriteInt(ByteBuf out, int value)Writes an integer as 32 bits to the outputByteBuf.(package private) voidwriteUnary(ByteBuf out, int value)Writes a zero-terminated unary number to the outputByteBuf.
-
-
-
Field Detail
-
bitBuffer
private long bitBuffer
A buffer of bits waiting to be written to the output stream.
-
bitCount
private int bitCount
The number of bits currently buffered inbitBuffer.
-
-
Method Detail
-
writeBits
void writeBits(ByteBuf out, int count, long value)
Writes up to 32 bits to the outputByteBuf.- Parameters:
count- The number of bits to write (maximum32as a size ofint)value- The bits to write
-
writeBoolean
void writeBoolean(ByteBuf out, boolean value)
Writes a single bit to the outputByteBuf.- Parameters:
value- The bit to write
-
writeUnary
void writeUnary(ByteBuf out, int value)
Writes a zero-terminated unary number to the outputByteBuf. Example of the output for value = 6:1111110- Parameters:
value- The number of1to write
-
writeInt
void writeInt(ByteBuf out, int value)
Writes an integer as 32 bits to the outputByteBuf.- Parameters:
value- The integer to write
-
-