Bzip2BlockCompressor Class — netty Architecture
Architecture documentation for the Bzip2BlockCompressor class in Bzip2BlockCompressor.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 14ecc34c_1aa7_b25b_4492_69c298ece54c["Bzip2BlockCompressor"] 758fcc46_4a00_7d32_9a9e_e22ca6f5b1c8["Bzip2BlockCompressor.java"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|defined in| 758fcc46_4a00_7d32_9a9e_e22ca6f5b1c8 e8b3e716_b5f2_37ba_914c_38a5b70587b6["Bzip2BlockCompressor()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| e8b3e716_b5f2_37ba_914c_38a5b70587b6 ddf1fea8_2bb0_574e_9ec5_c760c5648da3["writeSymbolMap()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| ddf1fea8_2bb0_574e_9ec5_c760c5648da3 531fad03_b1f1_8ad1_160b_6f41129f0f30["writeRun()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 531fad03_b1f1_8ad1_160b_6f41129f0f30 9c11989a_f32b_4f73_9dbc_19da6668a445["write()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 9c11989a_f32b_4f73_9dbc_19da6668a445 7cbb1b2c_aece_4497_adec_be1cc44c8782["close()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 7cbb1b2c_aece_4497_adec_be1cc44c8782 f96d9f93_cb77_5f30_05b4_4dc143c25083["availableSize()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| f96d9f93_cb77_5f30_05b4_4dc143c25083 1a500317_ec9c_73a9_9e8d_319a06fdf1a6["isFull()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 1a500317_ec9c_73a9_9e8d_319a06fdf1a6 6984d0d0_69da_2e75_f6bd_cb7be9120f9a["isEmpty()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 6984d0d0_69da_2e75_f6bd_cb7be9120f9a 3bd8f25b_d44e_1d00_cd56_1ed795467479["crc()"] 14ecc34c_1aa7_b25b_4492_69c298ece54c -->|method| 3bd8f25b_d44e_1d00_cd56_1ed795467479
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java lines 37–298
final class Bzip2BlockCompressor {
private final ByteProcessor writeProcessor = new ByteProcessor() {
@Override
public boolean process(byte value) throws Exception {
return write(value);
}
};
/**
* A writer that provides bit-level writes.
*/
private final Bzip2BitWriter writer;
/**
* CRC builder for the block.
*/
private final Crc32 crc = new Crc32();
/**
* The RLE'd block data.
*/
private final byte[] block;
/**
* Current length of the data within the {@link #block} array.
*/
private int blockLength;
/**
* A limit beyond which new data will not be accepted into the block.
*/
private final int blockLengthLimit;
/**
* The values that are present within the RLE'd block data. For each index, {@code true} if that
* value is present within the data, otherwise {@code false}.
*/
private final boolean[] blockValuesPresent = new boolean[256];
/**
* The Burrows Wheeler Transformed block data.
*/
private final int[] bwtBlock;
/**
* The current RLE value being accumulated (undefined when {@link #rleLength} is 0).
*/
private int rleCurrentValue = -1;
/**
* The repeat count of the current RLE value.
*/
private int rleLength;
/**
* @param writer The {@link Bzip2BitWriter} which provides bit-level writes
* @param blockSize The declared block size in bytes. Up to this many bytes will be accepted
* into the block after Run-Length Encoding is applied
*/
Bzip2BlockCompressor(final Bzip2BitWriter writer, final int blockSize) {
this.writer = writer;
// One extra byte is added to allow for the block wrap applied in close()
block = new byte[blockSize + 1];
bwtBlock = new int[blockSize + 1];
blockLengthLimit = blockSize - 6; // 5 bytes for one RLE run plus one byte - see {@link #write(int)}
}
/**
* Write the Huffman symbol to output byte map.
*/
private void writeSymbolMap(ByteBuf out) {
Bzip2BitWriter writer = this.writer;
final boolean[] blockValuesPresent = this.blockValuesPresent;
final boolean[] condensedInUse = new boolean[16];
for (int i = 0; i < condensedInUse.length; i++) {
for (int j = 0, k = i << 4; j < HUFFMAN_SYMBOL_RANGE_SIZE; j++, k++) {
if (blockValuesPresent[k]) {
condensedInUse[i] = true;
Defined In
Source
Frequently Asked Questions
What is the Bzip2BlockCompressor class?
Bzip2BlockCompressor is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java.
Where is Bzip2BlockCompressor defined?
Bzip2BlockCompressor is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free