Home / Class/ JZlibEncoder Class — netty Architecture

JZlibEncoder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6["JZlibEncoder"]
  48aa1964_caab_d2fa_768b_e2f6561860a0["JZlibEncoder.java"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|defined in| 48aa1964_caab_d2fa_768b_e2f6561860a0
  f571deff_e97d_2c94_dfab_d975d587775b["JZlibEncoder()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| f571deff_e97d_2c94_dfab_d975d587775b
  6d48df20_100d_0b52_c0b0_ea2cf6de3d12["ChannelFuture()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| 6d48df20_100d_0b52_c0b0_ea2cf6de3d12
  2411da96_0690_b5a6_d477_59901e7a4449["ChannelHandlerContext()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| 2411da96_0690_b5a6_d477_59901e7a4449
  86af1628_a2c7_5dea_630f_9c6bd4111d16["isClosed()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| 86af1628_a2c7_5dea_630f_9c6bd4111d16
  f0a5f09d_3615_cf2a_d358_6f7437d447e0["encode()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| f0a5f09d_3615_cf2a_d358_6f7437d447e0
  d0fb3463_02ce_7077_b96f_9f7d12a41b72["close()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| d0fb3463_02ce_7077_b96f_9f7d12a41b72
  0522db94_361b_cc2b_17a7_1fc3c7534239["handlerAdded()"]
  835bf072_cb98_c9aa_92d0_5d3c35dec6f6 -->|method| 0522db94_361b_cc2b_17a7_1fc3c7534239

Relationship Graph

Source Code

codec-compression/src/main/java/io/netty/handler/codec/compression/JZlibEncoder.java lines 37–401

public class JZlibEncoder extends ZlibEncoder {

    private final int wrapperOverhead;
    private final Deflater z = new Deflater();
    private volatile boolean finished;
    private volatile ChannelHandlerContext ctx;

    private static final int THREAD_POOL_DELAY_SECONDS = 10;

    /**
     * Creates a new zlib encoder with the default compression level ({@code 6}),
     * default window bits ({@code 15}), default memory level ({@code 8}),
     * and the default wrapper ({@link ZlibWrapper#ZLIB}).
     *
     * @throws CompressionException if failed to initialize zlib
     */
    public JZlibEncoder() {
        this(6);
    }

    /**
     * Creates a new zlib encoder with the specified {@code compressionLevel},
     * default window bits ({@code 15}), default memory level ({@code 8}),
     * and the default wrapper ({@link ZlibWrapper#ZLIB}).
     *
     * @param compressionLevel
     *        {@code 1} yields the fastest compression and {@code 9} yields the
     *        best compression.  {@code 0} means no compression.  The default
     *        compression level is {@code 6}.
     *
     * @throws CompressionException if failed to initialize zlib
     */
    public JZlibEncoder(int compressionLevel) {
        this(ZlibWrapper.ZLIB, compressionLevel);
    }

    /**
     * Creates a new zlib encoder with the default compression level ({@code 6}),
     * default window bits ({@code 15}), default memory level ({@code 8}),
     * and the specified wrapper.
     *
     * @throws CompressionException if failed to initialize zlib
     */
    public JZlibEncoder(ZlibWrapper wrapper) {
        this(wrapper, 6);
    }

    /**
     * Creates a new zlib encoder with the specified {@code compressionLevel},
     * default window bits ({@code 15}), default memory level ({@code 8}),
     * and the specified wrapper.
     *
     * @param compressionLevel
     *        {@code 1} yields the fastest compression and {@code 9} yields the
     *        best compression.  {@code 0} means no compression.  The default
     *        compression level is {@code 6}.
     *
     * @throws CompressionException if failed to initialize zlib
     */
    public JZlibEncoder(ZlibWrapper wrapper, int compressionLevel) {
        this(wrapper, compressionLevel, 15, 8);
    }

    /**
     * Creates a new zlib encoder with the specified {@code compressionLevel},
     * the specified {@code windowBits}, the specified {@code memLevel}, and
     * the specified wrapper.
     *
     * @param compressionLevel
     *        {@code 1} yields the fastest compression and {@code 9} yields the
     *        best compression.  {@code 0} means no compression.  The default
     *        compression level is {@code 6}.
     * @param windowBits
     *        The base two logarithm of the size of the history buffer.  The
     *        value should be in the range {@code 9} to {@code 15} inclusive.
     *        Larger values result in better compression at the expense of
     *        memory usage.  The default value is {@code 15}.
     * @param memLevel
     *        How much memory should be allocated for the internal compression
     *        state.  {@code 1} uses minimum memory and {@code 9} uses maximum
     *        memory.  Larger values result in better and faster compression

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free