final class Bzip2BlockCompressor
extends java.lang.Object
write(int)
close(ByteBuf)
(through Bzip2DivSufSort
)close(ByteBuf)
close(ByteBuf)
(through Bzip2HuffmanStageEncoder
)close(ByteBuf)
(through Bzip2HuffmanStageEncoder
)close(ByteBuf)
(through Bzip2HuffmanStageEncoder
)close(ByteBuf)
(through Bzip2HuffmanStageEncoder
)Modifier and Type | Field and Description |
---|---|
private byte[] |
block
The RLE'd block data.
|
private int |
blockLength
Current length of the data within the
block array. |
private int |
blockLengthLimit
A limit beyond which new data will not be accepted into the block.
|
private boolean[] |
blockValuesPresent
The values that are present within the RLE'd block data.
|
private int[] |
bwtBlock
The Burrows Wheeler Transformed block data.
|
private Crc32 |
crc
CRC builder for the block.
|
private int |
rleCurrentValue
The current RLE value being accumulated (undefined when
rleLength is 0). |
private int |
rleLength
The repeat count of the current RLE value.
|
private ByteProcessor |
writeProcessor |
private Bzip2BitWriter |
writer
A writer that provides bit-level writes.
|
Constructor and Description |
---|
Bzip2BlockCompressor(Bzip2BitWriter writer,
int blockSize) |
Modifier and Type | Method and Description |
---|---|
(package private) int |
availableSize()
Gets available size of the current block.
|
(package private) void |
close(ByteBuf out)
Compresses and writes out the block.
|
(package private) int |
crc()
Gets the CRC of the completed block.
|
(package private) boolean |
isEmpty()
Determines if any bytes have been written to the block.
|
(package private) boolean |
isFull()
Determines if the block is full and ready for compression.
|
(package private) int |
write(ByteBuf buffer,
int offset,
int length)
Writes an array to the block.
|
(package private) boolean |
write(int value)
Writes a byte to the block, accumulating to an RLE run where possible.
|
private void |
writeRun(int value,
int runLength)
Writes an RLE run to the block array, updating the block CRC and present values array as required.
|
private void |
writeSymbolMap(ByteBuf out)
Write the Huffman symbol to output byte map.
|
private final ByteProcessor writeProcessor
private final Bzip2BitWriter writer
private final Crc32 crc
private final byte[] block
private int blockLength
block
array.private final int blockLengthLimit
private final boolean[] blockValuesPresent
true
if that
value is present within the data, otherwise false
.private final int[] bwtBlock
private int rleCurrentValue
rleLength
is 0).private int rleLength
Bzip2BlockCompressor(Bzip2BitWriter writer, int blockSize)
writer
- The Bzip2BitWriter
which provides bit-level writesblockSize
- The declared block size in bytes. Up to this many bytes will be accepted
into the block after Run-Length Encoding is appliedprivate void writeSymbolMap(ByteBuf out)
private void writeRun(int value, int runLength)
value
- The value to writerunLength
- The run length of the value to writeboolean write(int value)
value
- The byte to writetrue
if the byte was written, or false
if the block is already fullint write(ByteBuf buffer, int offset, int length)
buffer
- The buffer to writeoffset
- The offset within the input data to write fromlength
- The number of bytes of input data to writevoid close(ByteBuf out)
int availableSize()
boolean isFull()
true
if the block is full, otherwise false
boolean isEmpty()
true
if one or more bytes has been written to the block, otherwise false
int crc()
close(ByteBuf)
.