Home / Function/ createEncoderFor() — netty Function Reference

createEncoderFor() — netty Function Reference

Architecture documentation for the createEncoderFor() function in HttpContentCompressor.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  93c84887_466a_4f4a_7fbd_608fea920e34["createEncoderFor()"]
  1a373d52_2146_2610_7650_6b487cdcefae["HttpContentCompressor"]
  93c84887_466a_4f4a_7fbd_608fea920e34 -->|defined in| 1a373d52_2146_2610_7650_6b487cdcefae
  058c003d_0fca_6751_f708_16e9fee143d4["Result()"]
  058c003d_0fca_6751_f708_16e9fee143d4 -->|calls| 93c84887_466a_4f4a_7fbd_608fea920e34
  style 93c84887_466a_4f4a_7fbd_608fea920e34 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java lines 282–326

    private MessageToByteEncoder<ByteBuf> createEncoderFor(String targetContentEncoding) {
        switch (targetContentEncoding) {
            case "br":
                if (brotliOptions == null || !Brotli.isAvailable()) {
                    throw new IllegalStateException("Brotli not configured");
                }
                return new BrotliEncoder(brotliOptions.parameters());
            case "zstd":
                if (zstdOptions == null) {
                    throw new IllegalStateException("Zstd not configured");
                }
                return new ZstdEncoder(
                        zstdOptions.compressionLevel(),
                        zstdOptions.blockSize(),
                        zstdOptions.maxEncodeSize()
                );
            case "snappy":
                if (snappyOptions == null) {
                    throw new IllegalStateException("Snappy not configured");
                }
                return new SnappyFrameEncoder();
            case "gzip":
                if (gzipOptions == null) {
                    throw new IllegalStateException("Gzip not configured");
                }
                return ZlibCodecFactory.newZlibEncoder(
                        ZlibWrapper.GZIP,
                        gzipOptions.compressionLevel(),
                        gzipOptions.windowBits(),
                        gzipOptions.memLevel()
                );
            case "deflate":
                if (deflateOptions == null) {
                    throw new IllegalStateException("Deflate not configured");
                }
                return ZlibCodecFactory.newZlibEncoder(
                        ZlibWrapper.ZLIB,
                        deflateOptions.compressionLevel(),
                        deflateOptions.windowBits(),
                        deflateOptions.memLevel()
                );
            default:
                throw new IllegalStateException("Unknown encoding: " + targetContentEncoding);
        }
    }

Subdomains

Called By

Frequently Asked Questions

What does createEncoderFor() do?
createEncoderFor() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java.
Where is createEncoderFor() defined?
createEncoderFor() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java at line 282.
What calls createEncoderFor()?
createEncoderFor() is called by 1 function(s): Result.

Analyze Your Own Codebase

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

Try Supermodel Free