Examples of GZipHeader


Examples of io.apigee.trireme.core.internal.GZipHeader

               if (mode == GZIP) {
                   // Because we are using Deflater rather than GZipOutputStream, we have to calculate the
                   // CRC and set up the GZip header ourselves. The GZipHeader class mainly does this for us.
                   checksum = new CRC32();

                   GZipHeader hdr = new GZipHeader();
                   hdr.setTimestamp(System.currentTimeMillis());
                   Buffer.BufferImpl buf =
                       Buffer.BufferImpl.newBuffer(cx, this, hdr.store(), false);
                   log.debug("Sending GZIP header");
                   cb.call(cx, this, this, new Object[] { Context.getUndefinedValue(), buf, false });
               }
               headerDone = true;
            }
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

                case INFLATERAW:
                    initInflate(true);
                    headerDone = true;
                    break;
                case GUNZIP:
                    GZipHeader hdr = GZipHeader.load(remaining);
                    if (hdr != null) {
                        headerDone = true;
                        initInflate(true);
                        checksum = new CRC32();
                        // We need to save the last eight bytes of all the input to eventually read the trailer
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

    @Test
    public void testBasicHeader()
        throws DataFormatException
    {
        final long now = System.currentTimeMillis();
        GZipHeader origHeader = new GZipHeader();
        origHeader.setTimestamp(now);
        ByteBuffer buf = origHeader.store();
        GZipHeader hdr = GZipHeader.load(buf);
        assertNotNull(hdr);
        assertNull(hdr.getFileName());
        assertNull(hdr.getComment());
        assertEquals((now / 1000L) * 1000L, hdr.getTimestamp());
    }
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

    public void testNameHeader()
        throws DataFormatException
    {
        final String NAME = "/usr/local/bin/emacs";

        GZipHeader origHeader = new GZipHeader();
        origHeader.setFileName(NAME);
        ByteBuffer buf = origHeader.store();
        GZipHeader hdr = GZipHeader.load(buf);
        assertNotNull(hdr);
        assertEquals(NAME, hdr.getFileName());
        assertNull(hdr.getComment());
    }
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

    public void testEmptyNameHeader()
        throws DataFormatException
    {
        final String NAME = "";

        GZipHeader origHeader = new GZipHeader();
        origHeader.setFileName(NAME);
        ByteBuffer buf = origHeader.store();
        GZipHeader hdr = GZipHeader.load(buf);
        assertNotNull(hdr);
        assertEquals(NAME, hdr.getFileName());
        assertNull(hdr.getComment());
    }
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

        throws DataFormatException
    {
        final String NAME = "/usr/local/bin/emacs";
        final String COMMENT = "This is a comment that someone might insert in a ZIP file";

        GZipHeader origHeader = new GZipHeader();
        origHeader.setFileName(NAME);
        origHeader.setComment(COMMENT);
        ByteBuffer buf = origHeader.store();
        GZipHeader hdr = GZipHeader.load(buf);
        assertNotNull(hdr);
        assertEquals(NAME, hdr.getFileName());
        assertEquals(COMMENT, hdr.getComment());
    }
View Full Code Here

Examples of io.apigee.trireme.core.internal.GZipHeader

        throws DataFormatException
    {
        final String NAME = "/usr/local/bin/emacs";
        final String COMMENT = "This is a comment that someone might insert in a ZIP file";

        GZipHeader origHeader = new GZipHeader();
        origHeader.setFileName(NAME);
        origHeader.setComment(COMMENT);
        ByteBuffer buf = origHeader.store();
        GZipHeader hdr;

        int origLimit = buf.limit();
        buf.limit(5);
        hdr = GZipHeader.load(buf);
        assertNull(hdr);
        buf.limit(13);
        hdr = GZipHeader.load(buf);
        assertNull(hdr);
        buf.limit(origLimit);

        hdr = GZipHeader.load(buf);
        assertNotNull(hdr);
        assertEquals(NAME, hdr.getFileName());
        assertEquals(COMMENT, hdr.getComment());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.