Home / Function/ initDecompressor() — netty Function Reference

initDecompressor() — netty Function Reference

Architecture documentation for the initDecompressor() function in DelegatingDecompressorFrameListener.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  dad4ac94_e709_5430_3802_707b4b8e8ca0["initDecompressor()"]
  5c336d64_231e_fffd_78be_6ce616e9bc8c["DelegatingDecompressorFrameListener"]
  dad4ac94_e709_5430_3802_707b4b8e8ca0 -->|defined in| 5c336d64_231e_fffd_78be_6ce616e9bc8c
  b272741e_73ec_9c96_d9fe_7440b0e45b49["onHeadersRead()"]
  b272741e_73ec_9c96_d9fe_7440b0e45b49 -->|calls| dad4ac94_e709_5430_3802_707b4b8e8ca0
  c9cdff4c_da69_9aa2_b935_e6ba7f270975["ConsumedBytesConverter()"]
  dad4ac94_e709_5430_3802_707b4b8e8ca0 -->|calls| c9cdff4c_da69_9aa2_b935_e6ba7f270975
  5d3e10a1_2485_47e9_aff0_57e2acb6d249["Http2Decompressor()"]
  dad4ac94_e709_5430_3802_707b4b8e8ca0 -->|calls| 5d3e10a1_2485_47e9_aff0_57e2acb6d249
  style dad4ac94_e709_5430_3802_707b4b8e8ca0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java lines 239–281

    private void initDecompressor(ChannelHandlerContext ctx, int streamId, Http2Headers headers, boolean endOfStream)
            throws Http2Exception {
        final Http2Stream stream = connection.stream(streamId);
        if (stream == null) {
            return;
        }

        Http2Decompressor decompressor = decompressor(stream);
        if (decompressor == null && !endOfStream) {
            // Determine the content encoding.
            CharSequence contentEncoding = headers.get(CONTENT_ENCODING);
            if (contentEncoding == null) {
                contentEncoding = IDENTITY;
            }
            final EmbeddedChannel channel = newContentDecompressor(ctx, contentEncoding);
            if (channel != null) {
                decompressor = new Http2Decompressor(channel, connection, listener);
                stream.setProperty(propertyKey, decompressor);
                // Decode the content and remove or replace the existing headers
                // so that the message looks like a decoded message.
                CharSequence targetContentEncoding = getTargetContentEncoding(contentEncoding);
                if (IDENTITY.contentEqualsIgnoreCase(targetContentEncoding)) {
                    headers.remove(CONTENT_ENCODING);
                } else {
                    headers.set(CONTENT_ENCODING, targetContentEncoding);
                }
            }
        }

        if (decompressor != null) {
            // The content length will be for the compressed data. Since we will decompress the data
            // this content-length will not be correct. Instead of queuing messages or delaying sending
            // header frames just remove the content-length header.
            headers.remove(CONTENT_LENGTH);

            // The first time that we initialize a decompressor, decorate the local flow controller to
            // properly convert consumed bytes.
            if (!flowControllerInitialized) {
                flowControllerInitialized = true;
                connection.local().flowController(new ConsumedBytesConverter(connection.local().flowController()));
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does initDecompressor() do?
initDecompressor() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java.
Where is initDecompressor() defined?
initDecompressor() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java at line 239.
What does initDecompressor() call?
initDecompressor() calls 2 function(s): ConsumedBytesConverter, Http2Decompressor.
What calls initDecompressor()?
initDecompressor() is called by 1 function(s): onHeadersRead.

Analyze Your Own Codebase

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

Try Supermodel Free