Home / Class/ JdkZlibDecoder Class — netty Architecture

JdkZlibDecoder Class — netty Architecture

Architecture documentation for the JdkZlibDecoder class in JdkZlibDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd["JdkZlibDecoder"]
  7c370729_94a6_b8bc_64e8_d347c2980a42["JdkZlibDecoder.java"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|defined in| 7c370729_94a6_b8bc_64e8_d347c2980a42
  ca861de0_2fde_a83c_66b8_29814a4e99d9["JdkZlibDecoder()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| ca861de0_2fde_a83c_66b8_29814a4e99d9
  ec82244d_2cee_85be_d432_08babd06bc55["isClosed()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| ec82244d_2cee_85be_d432_08babd06bc55
  f055bb74_306f_40f9_d9c1_85083f9dc74b["decode()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| f055bb74_306f_40f9_d9c1_85083f9dc74b
  9205ab31_1c96_0d6b_c04c_5f510827b2ac["handleGzipFooter()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 9205ab31_1c96_0d6b_c04c_5f510827b2ac
  1c17221c_46d2_f568_7996_6c9e8b8ee8c4["decompressionBufferExhausted()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 1c17221c_46d2_f568_7996_6c9e8b8ee8c4
  f159e9a5_3aec_9e2b_793a_054dc1c7c29f["handlerRemoved0()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| f159e9a5_3aec_9e2b_793a_054dc1c7c29f
  146f8d9e_03da_37c7_3683_c470a8d21243["readGZIPHeader()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 146f8d9e_03da_37c7_3683_c470a8d21243
  7b4beb12_b4f3_449d_8418_cc7cf01135ae["skipIfNeeded()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 7b4beb12_b4f3_449d_8418_cc7cf01135ae
  d0cd03db_9b26_0705_c3cd_3780ad92c927["readGZIPFooter()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| d0cd03db_9b26_0705_c3cd_3780ad92c927
  b05f4322_2917_b60e_0c34_198b6d36ffdc["verifyCrc()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| b05f4322_2917_b60e_0c34_198b6d36ffdc
  0005c058_d3b6_8d94_0a7b_5b5a71fa24c4["verifyCrc16()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 0005c058_d3b6_8d94_0a7b_5b5a71fa24c4
  fabc18b6_34b9_4520_1323_3857f8a35bb4["looksLikeZlib()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| fabc18b6_34b9_4520_1323_3857f8a35bb4
  74d253c2_55ad_cc1f_953a_1b4579e18857["channelReadComplete()"]
  bba68af7_04c2_8ee6_82f0_73e08fa3f9cd -->|method| 74d253c2_55ad_cc1f_953a_1b4579e18857

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java lines 32–544

public class JdkZlibDecoder extends ZlibDecoder {
    private static final int FHCRC = 0x02;
    private static final int FEXTRA = 0x04;
    private static final int FNAME = 0x08;
    private static final int FCOMMENT = 0x10;
    private static final int FRESERVED = 0xE0;

    private Inflater inflater;
    private final byte[] dictionary;

    // GZIP related
    private final ByteBufChecksum crc;
    private final boolean decompressConcatenated;

    private enum GzipState {
        HEADER_START,
        HEADER_END,
        FLG_READ,
        XLEN_READ,
        SKIP_FNAME,
        SKIP_COMMENT,
        PROCESS_FHCRC,
        FOOTER_START,
    }

    private GzipState gzipState = GzipState.HEADER_START;
    private int flags = -1;
    private int xlen = -1;
    private boolean needsRead;

    private volatile boolean finished;

    private boolean decideZlibOrNone;

    /**
     * Creates a new instance with the default wrapper ({@link ZlibWrapper#ZLIB}).
     *
     * @deprecated Use {@link JdkZlibDecoder#JdkZlibDecoder(int)}.
     */
    @Deprecated
    public JdkZlibDecoder() {
        this(ZlibWrapper.ZLIB, null, false, 0);
    }

    /**
     * Creates a new instance with the default wrapper ({@link ZlibWrapper#ZLIB})
     * and the specified maximum buffer allocation.
     *
     * @param maxAllocation
     *          Maximum size of the decompression buffer. Must be >= 0.
     *          If zero, maximum size is decided by the {@link ByteBufAllocator}.
     */
    public JdkZlibDecoder(int maxAllocation) {
        this(ZlibWrapper.ZLIB, null, false, maxAllocation);
    }

    /**
     * Creates a new instance with the specified preset dictionary. The wrapper
     * is always {@link ZlibWrapper#ZLIB} because it is the only format that
     * supports the preset dictionary.
     *
     * @deprecated Use {@link JdkZlibDecoder#JdkZlibDecoder(byte[], int)}.
     */
    @Deprecated
    public JdkZlibDecoder(byte[] dictionary) {
        this(ZlibWrapper.ZLIB, dictionary, false, 0);
    }

    /**
     * Creates a new instance with the specified preset dictionary and maximum buffer allocation.
     * The wrapper is always {@link ZlibWrapper#ZLIB} because it is the only format that
     * supports the preset dictionary.
     *
     * @param maxAllocation
     *          Maximum size of the decompression buffer. Must be >= 0.
     *          If zero, maximum size is decided by the {@link ByteBufAllocator}.
     */
    public JdkZlibDecoder(byte[] dictionary, int maxAllocation) {
        this(ZlibWrapper.ZLIB, dictionary, false, maxAllocation);
    }

Frequently Asked Questions

What is the JdkZlibDecoder class?
JdkZlibDecoder is a class in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java.
Where is JdkZlibDecoder defined?
JdkZlibDecoder is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java at line 32.

Analyze Your Own Codebase

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

Try Supermodel Free