class Bzip2BitReader
extends java.lang.Object
ByteBuf
when more bits are required.Modifier and Type | Field and Description |
---|---|
private long |
bitBuffer
A buffer of bits read from the input stream that have not yet been returned.
|
private int |
bitCount
The number of bits currently buffered in
bitBuffer . |
private ByteBuf |
in
The
ByteBuf from which to read data. |
private static int |
MAX_COUNT_OF_READABLE_BYTES
Maximum count of possible readable bytes to check.
|
Constructor and Description |
---|
Bzip2BitReader() |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
hasReadableBits(int count)
Checks that the specified number of bits available for reading.
|
(package private) boolean |
hasReadableBytes(int count)
Checks that the specified number of bytes available for reading.
|
(package private) boolean |
isReadable()
Checks that at least one bit is available for reading.
|
(package private) int |
readBits(int count)
Reads up to 32 bits from the
ByteBuf . |
(package private) boolean |
readBoolean()
Reads a single bit from the
ByteBuf . |
(package private) int |
readInt()
Reads 32 bits of input as an integer.
|
(package private) void |
refill()
Refill the
ByteBuf by one byte. |
(package private) void |
setByteBuf(ByteBuf in)
Set the
ByteBuf from which to read data. |
private static final int MAX_COUNT_OF_READABLE_BYTES
private long bitBuffer
private int bitCount
bitBuffer
.int readBits(int count)
ByteBuf
.count
- The number of bits to read (maximum 32
as a size of int
)boolean readBoolean()
ByteBuf
.true
if the bit read was 1
, otherwise false
int readInt()
void refill()
ByteBuf
by one byte.boolean isReadable()
true
if one bit is available for reading, otherwise false
boolean hasReadableBits(int count)
count
- The number of bits to checktrue
if count
bits are available for reading, otherwise false
boolean hasReadableBytes(int count)
count
- The number of bytes to checktrue
if count
bytes are available for reading, otherwise false