Home / Function/ ZlibWrapper() — netty Function Reference

ZlibWrapper() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a44196a5_6923_83ec_70d6_a0c9c31b2260["ZlibWrapper()"]
  1a373d52_2146_2610_7650_6b487cdcefae["HttpContentCompressor"]
  a44196a5_6923_83ec_70d6_a0c9c31b2260 -->|defined in| 1a373d52_2146_2610_7650_6b487cdcefae
  style a44196a5_6923_83ec_70d6_a0c9c31b2260 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java lines 403–444

    @Deprecated
    @SuppressWarnings("FloatingPointEquality")
    protected ZlibWrapper determineWrapper(String acceptEncoding) {
        float starQ = -1.0f;
        float gzipQ = -1.0f;
        float deflateQ = -1.0f;
        for (String encoding : acceptEncoding.split(",")) {
            float q = 1.0f;
            int equalsPos = encoding.indexOf('=');
            if (equalsPos != -1) {
                try {
                    q = Float.parseFloat(encoding.substring(equalsPos + 1));
                } catch (NumberFormatException e) {
                    // Ignore encoding
                    q = 0.0f;
                }
            }
            if (encoding.contains("*")) {
                starQ = q;
            } else if (encoding.contains("gzip") && q > gzipQ) {
                gzipQ = q;
            } else if (encoding.contains("deflate") && q > deflateQ) {
                deflateQ = q;
            }
        }
        if (gzipQ > 0.0f || deflateQ > 0.0f) {
            if (gzipQ >= deflateQ) {
                return ZlibWrapper.GZIP;
            } else {
                return ZlibWrapper.ZLIB;
            }
        }
        if (starQ > 0.0f) {
            if (gzipQ == -1.0f) {
                return ZlibWrapper.GZIP;
            }
            if (deflateQ == -1.0f) {
                return ZlibWrapper.ZLIB;
            }
        }
        return null;
    }

Subdomains

Frequently Asked Questions

What does ZlibWrapper() do?
ZlibWrapper() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java.
Where is ZlibWrapper() defined?
ZlibWrapper() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpContentCompressor.java at line 403.

Analyze Your Own Codebase

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

Try Supermodel Free