Top Description Fields Constructors Methods
io.netty.handler.codec.compression

pack-priv final Class Bzip2HuffmanStageDecoder

extends Object
Class Inheritance
Static Imports
io.netty.handler.codec.compression.Bzip2Constants.HUFFMAN_DECODE_MAX_CODE_LENGTH, .Bzip2Constants.HUFFMAN_GROUP_RUN_LENGTH, .Bzip2Constants.HUFFMAN_MAX_ALPHABET_SIZE

A decoder for the Bzip2 Huffman coding stage.

Field Summary

Modifier and TypeField and Description
pack-priv final int
alphabetSize

The total number of codes (uniform for each table).

private final int[][]
codeBases

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[][]
codeLimits

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[][]
codeSymbols

A mapping for each Huffman table from canonical code index to output symbol.

pack-priv int
pack-priv int
pack-priv int
pack-priv int
private int
currentTable

The Huffman table for the current group.

private int
groupIndex

The index of the current group within the selectors array.

private int
groupPosition

The byte position within the current group.

private final int[]
minimumLengths

The minimum code length for each Huffman table.

pack-priv boolean
private final Bzip2BitReader
reader

A reader that provides bit-level reads.

pack-priv byte[]
selectors

The Huffman table number to use for each group of 50 symbols.

pack-priv final byte[][]
tableCodeLengths

The Canonical Huffman code lengths for each table.

pack-priv final Bzip2MoveToFrontTable
tableMTF

Table for Move To Front transformations.

pack-priv final int
totalTables

Total number of used Huffman tables in range 2..6.

Constructor Summary

AccessConstructor and Description
pack-priv
Bzip2HuffmanStageDecoder(final Bzip2BitReader reader, final int totalTables, final int alphabetSize)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
createHuffmanDecodingTables()

Constructs Huffman decoding tables from lists of Canonical Huffman code lengths.

pack-priv int

Returns:

The decoded symbol
nextSymbol
()

Decodes and returns the next symbol.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alphabetSizeback to summary
pack-priv final int alphabetSize

The total number of codes (uniform for each table).

codeBasesback to summary
private final int[][] codeBases

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.

codeLimitsback to summary
private final int[][] codeLimits

An array of values for each Huffman table that gives the highest numerical value of a Huffman code of a given bit length.

codeSymbolsback to summary
private final int[][] codeSymbols

A mapping for each Huffman table from canonical code index to output symbol.

currentAlphaback to summary
pack-priv int currentAlpha
currentGroupback to summary
pack-priv int currentGroup
currentLengthback to summary
pack-priv int currentLength
currentSelectorback to summary
pack-priv int currentSelector
currentTableback to summary
private int currentTable

The Huffman table for the current group.

groupIndexback to summary
private int groupIndex

The index of the current group within the selectors array.

groupPositionback to summary
private int groupPosition

The byte position within the current group. A new group is selected every 50 decoded bytes.

minimumLengthsback to summary
private final int[] minimumLengths

The minimum code length for each Huffman table.

modifyLengthback to summary
pack-priv boolean modifyLength
readerback to summary
private final Bzip2BitReader reader

A reader that provides bit-level reads.

selectorsback to summary
pack-priv byte[] selectors

The Huffman table number to use for each group of 50 symbols.

tableCodeLengthsback to summary
pack-priv final byte[][] tableCodeLengths

The Canonical Huffman code lengths for each table.

tableMTFback to summary
pack-priv final Bzip2MoveToFrontTable tableMTF

Table for Move To Front transformations.

totalTablesback to summary
pack-priv final int totalTables

Total number of used Huffman tables in range 2..6.

Constructor Detail

Bzip2HuffmanStageDecoderback to summary
pack-priv Bzip2HuffmanStageDecoder(final Bzip2BitReader reader, final int totalTables, final int alphabetSize)

Method Detail

createHuffmanDecodingTablesback to summary
pack-priv void createHuffmanDecodingTables()

Constructs Huffman decoding tables from lists of Canonical Huffman code lengths.

nextSymbolback to summary
pack-priv int nextSymbol()

Decodes and returns the next symbol.

Returns:int

The decoded symbol