Class Bzip2HuffmanStageDecoder

java.lang.Object
io.netty.handler.codec.compression.Bzip2HuffmanStageDecoder

final class Bzip2HuffmanStageDecoder extends Object
A decoder for the Bzip2 Huffman coding stage.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (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

    Constructors
    Constructor
    Description
    Bzip2HuffmanStageDecoder(Bzip2BitReader reader, int totalTables, int alphabetSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Constructs Huffman decoding tables from lists of Canonical Huffman code lengths.
    (package private) int
    Decodes and returns the next symbol.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • reader

      private final Bzip2BitReader reader
      A reader that provides bit-level reads.
    • selectors

      byte[] selectors
      The Huffman table number to use for each group of 50 symbols.
    • minimumLengths

      private final int[] minimumLengths
      The minimum code length for each Huffman table.
    • codeBases

      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.
    • codeLimits

      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.
    • codeSymbols

      private final int[][] codeSymbols
      A mapping for each Huffman table from canonical code index to output symbol.
    • currentTable

      private int currentTable
      The Huffman table for the current group.
    • groupIndex

      private int groupIndex
      The index of the current group within the selectors array.
    • groupPosition

      private int groupPosition
      The byte position within the current group. A new group is selected every 50 decoded bytes.
    • totalTables

      final int totalTables
      Total number of used Huffman tables in range 2..6.
    • alphabetSize

      final int alphabetSize
      The total number of codes (uniform for each table).
    • tableMTF

      final Bzip2MoveToFrontTable tableMTF
      Table for Move To Front transformations.
    • currentSelector

      int currentSelector
    • tableCodeLengths

      final byte[][] tableCodeLengths
      The 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