Home / Function/ decompress() — netty Function Reference

decompress() — netty Function Reference

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

Function java Buffer Allocators calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  3f8b72ec_5811_f332_169d_95c90074faa4["decompress()"]
  5daed817_25b8_7048_df6a_dfebd688213d["Http2Decompressor"]
  3f8b72ec_5811_f332_169d_95c90074faa4 -->|defined in| 5daed817_25b8_7048_df6a_dfebd688213d
  57403601_677c_34ae_4ad2_1ca3c636837c["onDataRead()"]
  57403601_677c_34ae_4ad2_1ca3c636837c -->|calls| 3f8b72ec_5811_f332_169d_95c90074faa4
  5b535dcb_154a_329f_7d30_64ed548f02b1["incrementCompressedBytes()"]
  3f8b72ec_5811_f332_169d_95c90074faa4 -->|calls| 5b535dcb_154a_329f_7d30_64ed548f02b1
  9ea1931e_5f39_7536_e536_f68714591f6c["incrementDecompressedBytes()"]
  3f8b72ec_5811_f332_169d_95c90074faa4 -->|calls| 9ea1931e_5f39_7536_e536_f68714591f6c
  style 3f8b72ec_5811_f332_169d_95c90074faa4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java lines 411–448

        int decompress(ChannelHandlerContext ctx, Http2Stream stream, ByteBuf data, int padding, boolean endOfStream)
                throws Http2Exception {
            final int compressedBytes = data.readableBytes() + padding;
            incrementCompressedBytes(compressedBytes);
            try {
                this.stream = stream;
                this.padding = padding;
                this.dataDecompressed = false;
                this.targetCtx = ctx;

                // call retain here as it will call release after its written to the channel
                decompressor.writeInbound(data.retain());
                if (endOfStream) {
                    decompressor.finish();

                    if (!dataDecompressed) {
                        // No new decompressed data was extracted from the compressed data. This means the application
                        // could not be provided with data and thus could not return how many bytes were processed.
                        // We will assume there is more data coming which will complete the decompression block.
                        // To allow for more data we return all bytes to the flow control window (so the peer can
                        // send more data).
                        incrementDecompressedBytes(compressedBytes);
                        return compressedBytes;
                    }
                }
                // We consume bytes each time we call the listener to ensure if multiple frames are decompressed
                // that the bytes are accounted for immediately. Otherwise the user may see an inconsistent state of
                // flow control.
                return 0;
            } catch (Throwable t) {
                // Http2Exception might be thrown by writeInbound(...) or finish().
                if (t instanceof Http2Exception) {
                    throw (Http2Exception) t;
                }
                throw streamError(stream.id(), INTERNAL_ERROR, t,
                        "Decompressor error detected while delegating data read on streamId %d", stream.id());
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does decompress() do?
decompress() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java.
Where is decompress() defined?
decompress() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java at line 411.
What does decompress() call?
decompress() calls 2 function(s): incrementCompressedBytes, incrementDecompressedBytes.
What calls decompress()?
decompress() is called by 1 function(s): onDataRead.

Analyze Your Own Codebase

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

Try Supermodel Free