Home / Function/ gzCompress() — netty Function Reference

gzCompress() — netty Function Reference

Architecture documentation for the gzCompress() function in HttpContentDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5caa38f2_c5ef_f0aa_7137_fa3175b891df["gzCompress()"]
  ea4ec426_b689_ab52_a554_7959aed6c709["HttpContentDecoderTest"]
  5caa38f2_c5ef_f0aa_7137_fa3175b891df -->|defined in| ea4ec426_b689_ab52_a554_7959aed6c709
  14854d12_c5f6_6934_ec39_441b8a359663["testBinaryDecompression()"]
  14854d12_c5f6_6934_ec39_441b8a359663 -->|calls| 5caa38f2_c5ef_f0aa_7137_fa3175b891df
  style 5caa38f2_c5ef_f0aa_7137_fa3175b891df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java lines 879–903

    private static byte[] gzCompress(byte[] input) {
        ZlibEncoder encoder = ZlibCodecFactory.newZlibEncoder(ZlibWrapper.GZIP);
        EmbeddedChannel channel = new EmbeddedChannel(encoder);
        assertTrue(channel.writeOutbound(Unpooled.wrappedBuffer(input)));
        assertTrue(channel.finish());  // close the channel to indicate end-of-data

        int outputSize = 0;
        ByteBuf o;
        List<ByteBuf> outbound = new ArrayList<ByteBuf>();
        while ((o = channel.readOutbound()) != null) {
            outbound.add(o);
            outputSize += o.readableBytes();
        }

        byte[] output = new byte[outputSize];
        int readCount = 0;
        for (ByteBuf b : outbound) {
            int readableBytes = b.readableBytes();
            b.readBytes(output, readCount, readableBytes);
            b.release();
            readCount += readableBytes;
        }
        assertTrue(channel.inboundMessages().isEmpty() && channel.outboundMessages().isEmpty());
        return output;
    }

Domain

Subdomains

Frequently Asked Questions

What does gzCompress() do?
gzCompress() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java.
Where is gzCompress() defined?
gzCompress() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentDecoderTest.java at line 879.
What calls gzCompress()?
gzCompress() is called by 1 function(s): testBinaryDecompression.

Analyze Your Own Codebase

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

Try Supermodel Free