Bzip2MTFAndRLE2StageEncoder Class — netty Architecture
Architecture documentation for the Bzip2MTFAndRLE2StageEncoder class in Bzip2MTFAndRLE2StageEncoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5["Bzip2MTFAndRLE2StageEncoder"] 1058cc7a_3e04_80fc_54fa_ca72c83818a1["Bzip2MTFAndRLE2StageEncoder.java"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|defined in| 1058cc7a_3e04_80fc_54fa_ca72c83818a1 695dbd00_dda0_f758_6833_ee5e59b0d402["Bzip2MTFAndRLE2StageEncoder()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| 695dbd00_dda0_f758_6833_ee5e59b0d402 509ec1c0_9350_e629_18fa_f1398316a852["encode()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| 509ec1c0_9350_e629_18fa_f1398316a852 2d69715e_070c_b566_bafb_e07fa51d9ad0["mtfBlock()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| 2d69715e_070c_b566_bafb_e07fa51d9ad0 a984e690_e205_c0c5_11d1_1b2e24fedd66["mtfLength()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| a984e690_e205_c0c5_11d1_1b2e24fedd66 286943b8_cd04_8986_8aaf_f94bab264f4d["mtfAlphabetSize()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| 286943b8_cd04_8986_8aaf_f94bab264f4d 999e8ff8_4241_97f3_3b02_8fd6d19725ff["mtfSymbolFrequencies()"] c4dd1a1c_1efa_15bf_366b_7ccf81c06cd5 -->|method| 999e8ff8_4241_97f3_3b02_8fd6d19725ff
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2MTFAndRLE2StageEncoder.java lines 27–185
final class Bzip2MTFAndRLE2StageEncoder {
/**
* The Burrows-Wheeler transformed block.
*/
private final int[] bwtBlock;
/**
* Actual length of the data in the {@link #bwtBlock} array.
*/
private final int bwtLength;
/**
* At each position, {@code true} if the byte value with that index is present within the block,
* otherwise {@code false}.
*/
private final boolean[] bwtValuesPresent;
/**
* The output of the Move To Front Transform and Run-Length Encoding[2] stages.
*/
private final char[] mtfBlock;
/**
* The actual number of values contained in the {@link #mtfBlock} array.
*/
private int mtfLength;
/**
* The global frequencies of values within the {@link #mtfBlock} array.
*/
private final int[] mtfSymbolFrequencies = new int[HUFFMAN_MAX_ALPHABET_SIZE];
/**
* The encoded alphabet size.
*/
private int alphabetSize;
/**
* @param bwtBlock The Burrows Wheeler Transformed block data
* @param bwtLength The actual length of the BWT data
* @param bwtValuesPresent The values that are present within the BWT data. For each index,
* {@code true} if that value is present within the data, otherwise {@code false}
*/
Bzip2MTFAndRLE2StageEncoder(final int[] bwtBlock, final int bwtLength, final boolean[] bwtValuesPresent) {
this.bwtBlock = bwtBlock;
this.bwtLength = bwtLength;
this.bwtValuesPresent = bwtValuesPresent;
mtfBlock = new char[bwtLength + 1];
}
/**
* Performs the Move To Front transform and Run Length Encoding[1] stages.
*/
void encode() {
final int bwtLength = this.bwtLength;
final boolean[] bwtValuesPresent = this.bwtValuesPresent;
final int[] bwtBlock = this.bwtBlock;
final char[] mtfBlock = this.mtfBlock;
final int[] mtfSymbolFrequencies = this.mtfSymbolFrequencies;
final byte[] huffmanSymbolMap = new byte[256];
final Bzip2MoveToFrontTable symbolMTF = new Bzip2MoveToFrontTable();
int totalUniqueValues = 0;
for (int i = 0; i < huffmanSymbolMap.length; i++) {
if (bwtValuesPresent[i]) {
huffmanSymbolMap[i] = (byte) totalUniqueValues++;
}
}
final int endOfBlockSymbol = totalUniqueValues + 1;
int mtfIndex = 0;
int repeatCount = 0;
int totalRunAs = 0;
int totalRunBs = 0;
for (int i = 0; i < bwtLength; i++) {
// Move To Front
final int mtfPosition = symbolMTF.valueToFront(huffmanSymbolMap[bwtBlock[i] & 0xff]);
// Run Length Encode
if (mtfPosition == 0) {
repeatCount++;
} else {
Defined In
Source
Frequently Asked Questions
What is the Bzip2MTFAndRLE2StageEncoder class?
Bzip2MTFAndRLE2StageEncoder is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2MTFAndRLE2StageEncoder.java.
Where is Bzip2MTFAndRLE2StageEncoder defined?
Bzip2MTFAndRLE2StageEncoder is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2MTFAndRLE2StageEncoder.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free