Class Bzip2HuffmanStageDecoder
java.lang.Object
io.netty.handler.codec.compression.Bzip2HuffmanStageDecoder
A decoder for the Bzip2 Huffman coding stage.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
The total number of codes (uniform for each table).private final int[][]
An array of values for each Huffman table that must be subtracted from the numerical value of a Huffman code of a given bit length to give its canonical code index.private final int[][]
An array of values for each Huffman table that gives the highest numerical value of a Huffman code of a given bit length.private final int[][]
A mapping for each Huffman table from canonical code index to output symbol.(package private) int
(package private) int
(package private) int
(package private) int
private int
The Huffman table for the current group.private int
The index of the current group within the selectors array.private int
The byte position within the current group.private final int[]
The minimum code length for each Huffman table.(package private) boolean
private final Bzip2BitReader
A reader that provides bit-level reads.(package private) byte[]
The Huffman table number to use for each group of 50 symbols.(package private) final byte[][]
The Canonical Huffman code lengths for each table.(package private) final Bzip2MoveToFrontTable
Table for Move To Front transformations.(package private) final int
Total number of used Huffman tables in range 2..6. -
Constructor Summary
ConstructorsConstructorDescriptionBzip2HuffmanStageDecoder
(Bzip2BitReader reader, int totalTables, int alphabetSize) -
Method Summary
Modifier and TypeMethodDescription(package private) void
Constructs Huffman decoding tables from lists of Canonical Huffman code lengths.(package private) int
Decodes and returns the next symbol.
-
Field Details
-
reader
A reader that provides bit-level reads. -
selectors
byte[] selectorsThe Huffman table number to use for each group of 50 symbols. -
minimumLengths
private final int[] minimumLengthsThe minimum code length for each Huffman table. -
codeBases
private final int[][] codeBasesAn array of values for each Huffman table that must be subtracted from the numerical value of a Huffman code of a given bit length to give its canonical code index. -
codeLimits
private final int[][] codeLimitsAn array of values for each Huffman table that gives the highest numerical value of a Huffman code of a given bit length. -
codeSymbols
private final int[][] codeSymbolsA mapping for each Huffman table from canonical code index to output symbol. -
currentTable
private int currentTableThe Huffman table for the current group. -
groupIndex
private int groupIndexThe index of the current group within the selectors array. -
groupPosition
private int groupPositionThe byte position within the current group. A new group is selected every 50 decoded bytes. -
totalTables
final int totalTablesTotal number of used Huffman tables in range 2..6. -
alphabetSize
final int alphabetSizeThe total number of codes (uniform for each table). -
tableMTF
Table for Move To Front transformations. -
currentSelector
int currentSelector -
tableCodeLengths
final byte[][] tableCodeLengthsThe Canonical Huffman code lengths for each table. -
currentGroup
int currentGroup -
currentLength
int currentLength -
currentAlpha
int currentAlpha -
modifyLength
boolean modifyLength
-
-
Constructor Details
-
Bzip2HuffmanStageDecoder
Bzip2HuffmanStageDecoder(Bzip2BitReader reader, int totalTables, int alphabetSize)
-
-
Method Details
-
createHuffmanDecodingTables
void createHuffmanDecodingTables()Constructs Huffman decoding tables from lists of Canonical Huffman code lengths. -
nextSymbol
int nextSymbol()Decodes and returns the next symbol.- Returns:
- The decoded symbol
-