Home / Function/ testGZIPCompressOnly0() — netty Function Reference

testGZIPCompressOnly0() — netty Function Reference

Architecture documentation for the testGZIPCompressOnly0() function in ZlibTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c8fa40c8_ae0a_dfb9_072e_594447544a0e["testGZIPCompressOnly0()"]
  7036d690_c470_1931_3ca2_5fffb656bebb["ZlibTest"]
  c8fa40c8_ae0a_dfb9_072e_594447544a0e -->|defined in| 7036d690_c470_1931_3ca2_5fffb656bebb
  0510c964_5a2c_0b15_c9c2_ddf47384107e["testGZIPCompressOnly()"]
  0510c964_5a2c_0b15_c9c2_ddf47384107e -->|calls| c8fa40c8_ae0a_dfb9_072e_594447544a0e
  style c8fa40c8_ae0a_dfb9_072e_594447544a0e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java lines 352–388

    private void testGZIPCompressOnly0(byte[] data) throws IOException {
        EmbeddedChannel chEncoder = new EmbeddedChannel(createEncoder(ZlibWrapper.GZIP));
        if (data != null) {
            chEncoder.writeOutbound(Unpooled.wrappedBuffer(data));
        }
        assertTrue(chEncoder.finish());

        ByteBuf encoded = Unpooled.buffer();
        for (;;) {
            ByteBuf buf = chEncoder.readOutbound();
            if (buf == null) {
                break;
            }
            encoded.writeBytes(buf);
            buf.release();
        }

        ByteBuf decoded = Unpooled.buffer();
        try (GZIPInputStream stream = new GZIPInputStream(new ByteBufInputStream(encoded, true))) {
            byte[] buf = new byte[8192];
            for (;;) {
                int readBytes = stream.read(buf);
                if (readBytes < 0) {
                    break;
                }
                decoded.writeBytes(buf, 0, readBytes);
            }
        }

        if (data != null) {
            assertEquals(Unpooled.wrappedBuffer(data), decoded);
        } else {
            assertFalse(decoded.isReadable());
        }

        decoded.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testGZIPCompressOnly0() do?
testGZIPCompressOnly0() is a function in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java.
Where is testGZIPCompressOnly0() defined?
testGZIPCompressOnly0() is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java at line 352.
What calls testGZIPCompressOnly0()?
testGZIPCompressOnly0() is called by 1 function(s): testGZIPCompressOnly.

Analyze Your Own Codebase

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

Try Supermodel Free