Home / Class/ ZlibTest Class — netty Architecture

ZlibTest Class — netty Architecture

Architecture documentation for the ZlibTest class in ZlibTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7036d690_c470_1931_3ca2_5fffb656bebb["ZlibTest"]
  0d77c5c0_96fa_b31e_7432_859b57783ef6["ZlibTest.java"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|defined in| 0d77c5c0_96fa_b31e_7432_859b57783ef6
  663faaab_960a_0324_36d7_72734bf0a344["ZlibDecoder()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 663faaab_960a_0324_36d7_72734bf0a344
  fc262eab_eef4_bd90_141a_05ad94e408ea["ZlibEncoder()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| fc262eab_eef4_bd90_141a_05ad94e408ea
  68c038d9_43a9_a728_66e1_b0f0176653a5["testGZIP2()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 68c038d9_43a9_a728_66e1_b0f0176653a5
  d8de06d4_568e_39e8_a7a7_d9ef11455094["testGZIP3()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| d8de06d4_568e_39e8_a7a7_d9ef11455094
  9dc264cb_0953_efd8_30d0_ff4d823d2756["testCompress0()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 9dc264cb_0953_efd8_30d0_ff4d823d2756
  099a1ed6_9fe3_3fd6_7405_b857b222559f["testCompressNone()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 099a1ed6_9fe3_3fd6_7405_b857b222559f
  4ce8bff0_577d_fb67_462a_3c492abedec9["dispose()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 4ce8bff0_577d_fb67_462a_3c492abedec9
  c8c6bcac_9b29_6541_75ce_64b7469a9ac5["testDecompressOnly()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| c8c6bcac_9b29_6541_75ce_64b7469a9ac5
  b023fcda_0473_29df_baf0_dfe51cb70d3c["testCompressSmall()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| b023fcda_0473_29df_baf0_dfe51cb70d3c
  c6ad729e_c0ad_fe32_83e3_3b6b2bf98e32["testCompressLarge()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| c6ad729e_c0ad_fe32_83e3_3b6b2bf98e32
  9b5f9061_d9e5_d62f_c29a_31a2beb090eb["testZLIB()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| 9b5f9061_d9e5_d62f_c29a_31a2beb090eb
  f257d438_b442_f0d3_e131_7a93c3e0bb65["testNONE()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| f257d438_b442_f0d3_e131_7a93c3e0bb65
  feab9313_a73f_4959_e55e_b6923872a62a["testGZIP()"]
  7036d690_c470_1931_3ca2_5fffb656bebb -->|method| feab9313_a73f_4959_e55e_b6923872a62a

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java lines 45–476

public abstract class ZlibTest {

    private static final byte[] BYTES_SMALL = new byte[128];
    private static final byte[] BYTES_LARGE = new byte[1024 * 1024];
    private static final byte[] BYTES_LARGE2 = ("<!--?xml version=\"1.0\" encoding=\"ISO-8859-1\"?-->\n" +
            "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " +
            "\"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" +
            "<html xmlns=\"https://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"><head>\n" +
            "    <title>Apache Tomcat</title>\n" +
            "</head>\n" +
            '\n' +
            "<body>\n" +
            "<h1>It works !</h1>\n" +
            '\n' +
            "<p>If you're seeing this page via a web browser, it means you've setup Tomcat successfully." +
            " Congratulations!</p>\n" +
            " \n" +
            "<p>This is the default Tomcat home page." +
            " It can be found on the local filesystem at: <code>/var/lib/tomcat7/webapps/ROOT/index.html</code></p>\n" +
            '\n' +
            "<p>Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with" +
            " <code>CATALINA_HOME</code> in <code>/usr/share/tomcat7</code> and <code>CATALINA_BASE</code> in" +
            " <code>/var/lib/tomcat7</code>, following the rules from" +
            " <code>/usr/share/doc/tomcat7-common/RUNNING.txt.gz</code>.</p>\n" +
            '\n' +
            "<p>You might consider installing the following packages, if you haven't already done so:</p>\n" +
            '\n' +
            "<p><b>tomcat7-docs</b>: This package installs a web application that allows to browse the Tomcat 7" +
            " documentation locally. Once installed, you can access it by clicking <a href=\"docs/\">here</a>.</p>\n" +
            '\n' +
            "<p><b>tomcat7-examples</b>: This package installs a web application that allows to access the Tomcat" +
            " 7 Servlet and JSP examples. Once installed, you can access it by clicking" +
            " <a href=\"examples/\">here</a>.</p>\n" +
            '\n' +
            "<p><b>tomcat7-admin</b>: This package installs two web applications that can help managing this Tomcat" +
            " instance. Once installed, you can access the <a href=\"manager/html\">manager webapp</a> and" +
            " the <a href=\"host-manager/html\">host-manager webapp</a>.</p><p>\n" +
            '\n' +
            "</p><p>NOTE: For security reasons, using the manager webapp is restricted" +
            " to users with role \"manager\"." +
            " The host-manager webapp is restricted to users with role \"admin\". Users are " +
            "defined in <code>/etc/tomcat7/tomcat-users.xml</code>.</p>\n" +
            '\n' +
            '\n' +
            '\n' +
            "</body></html>").getBytes(CharsetUtil.UTF_8);

    static {
        Random rand = ThreadLocalRandom.current();
        rand.nextBytes(BYTES_SMALL);
        rand.nextBytes(BYTES_LARGE);
    }

    protected ZlibDecoder createDecoder(ZlibWrapper wrapper) {
        return createDecoder(wrapper, 0);
    }

    protected abstract ZlibEncoder createEncoder(ZlibWrapper wrapper);
    protected abstract ZlibDecoder createDecoder(ZlibWrapper wrapper, int maxAllocation);

    @Test
    public void testGZIP2() throws Exception {
        byte[] bytes = "message".getBytes(CharsetUtil.UTF_8);
        ByteBuf data = Unpooled.wrappedBuffer(bytes);
        ByteBuf deflatedData = Unpooled.wrappedBuffer(gzip(bytes));

        EmbeddedChannel chDecoderGZip = new EmbeddedChannel(createDecoder(ZlibWrapper.GZIP));
        try {
            while (deflatedData.isReadable()) {
                chDecoderGZip.writeInbound(deflatedData.readRetainedSlice(1));
            }
            deflatedData.release();
            assertTrue(chDecoderGZip.finish());
            ByteBuf buf = Unpooled.buffer();
            for (;;) {
                ByteBuf b = chDecoderGZip.readInbound();
                if (b == null) {
                    break;
                }
                buf.writeBytes(b);
                b.release();

Frequently Asked Questions

What is the ZlibTest class?
ZlibTest is a class in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java.
Where is ZlibTest defined?
ZlibTest is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/ZlibTest.java at line 45.

Analyze Your Own Codebase

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

Try Supermodel Free