Home / Function/ nextSymbol() — netty Function Reference

nextSymbol() — netty Function Reference

Architecture documentation for the nextSymbol() function in Bzip2HuffmanStageDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e40f42bb_dad0_229d_34dc_ece94099165b["nextSymbol()"]
  14c72e79_23d2_4aa5_16ea_6018c1df750a["Bzip2HuffmanStageDecoder"]
  e40f42bb_dad0_229d_34dc_ece94099165b -->|defined in| 14c72e79_23d2_4aa5_16ea_6018c1df750a
  style e40f42bb_dad0_229d_34dc_ece94099165b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java lines 173–202

    int nextSymbol() {
        // Move to next group selector if required
        if (++groupPosition % HUFFMAN_GROUP_RUN_LENGTH == 0) {
            groupIndex++;
            if (groupIndex == selectors.length) {
                throw new DecompressionException("error decoding block");
            }
            currentTable = selectors[groupIndex] & 0xff;
        }

        final Bzip2BitReader reader = this.reader;
        final int currentTable = this.currentTable;
        final int[] tableLimits = codeLimits[currentTable];
        final int[] tableBases = codeBases[currentTable];
        final int[] tableSymbols = codeSymbols[currentTable];
        int codeLength = minimumLengths[currentTable];

        // Starting with the minimum bit length for the table, read additional bits one at a time
        // until a complete code is recognised
        int codeBits = reader.readBits(codeLength);
        for (; codeLength <= HUFFMAN_DECODE_MAX_CODE_LENGTH; codeLength++) {
            if (codeBits <= tableLimits[codeLength]) {
                // Convert the code to a symbol index and return
                return tableSymbols[codeBits - tableBases[codeLength]];
            }
            codeBits = codeBits << 1 | reader.readBits(1);
        }

        throw new DecompressionException("a valid code was not recognised");
    }

Domain

Subdomains

Frequently Asked Questions

What does nextSymbol() do?
nextSymbol() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java.
Where is nextSymbol() defined?
nextSymbol() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageDecoder.java at line 173.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free