Home / Class/ HttpContentCompressor Class — netty Architecture

HttpContentCompressor Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  1a373d52_2146_2610_7650_6b487cdcefae["HttpContentCompressor"]
  d400c074_2717_7e26_f03f_afcc5ae60701["HttpContentCompressor.java"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|defined in| d400c074_2717_7e26_f03f_afcc5ae60701
  286433a4_a7ea_84c5_8f49_b9d55c935c2a["HttpContentCompressor()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| 286433a4_a7ea_84c5_8f49_b9d55c935c2a
  ea63877a_0285_d386_09fb_bcd85e2fd3a6["defaultCompressionOptions()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| ea63877a_0285_d386_09fb_bcd85e2fd3a6
  8ee8aea1_d5b8_4a63_9a8f_e9ed35e41b0b["handlerAdded()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| 8ee8aea1_d5b8_4a63_9a8f_e9ed35e41b0b
  058c003d_0fca_6751_f708_16e9fee143d4["Result()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| 058c003d_0fca_6751_f708_16e9fee143d4
  93c84887_466a_4f4a_7fbd_608fea920e34["createEncoderFor()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| 93c84887_466a_4f4a_7fbd_608fea920e34
  a15b132b_a186_c83b_c808_35e1c94c6bae["String()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| a15b132b_a186_c83b_c808_35e1c94c6bae
  a44196a5_6923_83ec_70d6_a0c9c31b2260["ZlibWrapper()"]
  1a373d52_2146_2610_7650_6b487cdcefae -->|method| a44196a5_6923_83ec_70d6_a0c9c31b2260

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java lines 51–446

public class HttpContentCompressor extends HttpContentEncoder {

    private final BrotliOptions brotliOptions;
    private final GzipOptions gzipOptions;
    private final DeflateOptions deflateOptions;
    private final ZstdOptions zstdOptions;
    private final SnappyOptions snappyOptions;

    private final int contentSizeThreshold;
    private ChannelHandlerContext ctx;

    private static final CompressionOptions[] DEFAULT_COMPRESSION_OPTIONS;
    static {
        List<CompressionOptions> options = new ArrayList<>(5);
        options.add(StandardCompressionOptions.gzip());
        options.add(StandardCompressionOptions.deflate());
        options.add(StandardCompressionOptions.snappy());
        if (Brotli.isAvailable()) {
            options.add(StandardCompressionOptions.brotli());
        }
        if (Zstd.isAvailable()) {
            options.add(StandardCompressionOptions.zstd());
        }
        DEFAULT_COMPRESSION_OPTIONS = options.toArray(new CompressionOptions[0]);
    }

    /**
     * Creates a new handler with {@link StandardCompressionOptions#brotli()} (if supported) ,
     * {@link StandardCompressionOptions#zstd()} (if supported), {@link StandardCompressionOptions#snappy()},
     * {@link StandardCompressionOptions#gzip()} and {@link StandardCompressionOptions#deflate()}.
     */
    public HttpContentCompressor() {
        this(0, (CompressionOptions[]) null);
    }

    /**
     * Creates a new handler with the specified compression level, default
     * window size (<tt>15</tt>) and default memory level (<tt>8</tt>).
     *
     * @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}.
     */
    @Deprecated
    public HttpContentCompressor(int compressionLevel) {
        this(compressionLevel, 15, 8, 0);
    }

    /**
     * Creates a new handler with the specified compression level, window size,
     * and memory level.
     *
     * @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
     *        at the expense of memory usage.  The default value is {@code 8}
     */
    @Deprecated
    public HttpContentCompressor(int compressionLevel, int windowBits, int memLevel) {
        this(compressionLevel, windowBits, memLevel, 0);
    }

    /**
     * Creates a new handler with the specified compression level, window size,
     * and memory level.
     *
     * @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}.

Frequently Asked Questions

What is the HttpContentCompressor class?
HttpContentCompressor is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java.
Where is HttpContentCompressor defined?
HttpContentCompressor is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java at line 51.

Analyze Your Own Codebase

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

Try Supermodel Free