Package java.util.zip

Examples of java.util.zip.InflaterInputStream.available()


        Assert.assertEquals("3", IOUtils.readString(inf1));
        Assert.assertEquals("4", IOUtils.readString(inf1));
        Assert.assertEquals("5", IOUtils.readString(inf1));
        Assert.assertEquals("6", IOUtils.readString(inf1));

        Assert.assertEquals(1, inf1.available());
        Assert.assertEquals(-1, inf1.read());
        Assert.assertEquals(0, inf1.available());
    }

}
View Full Code Here


        Assert.assertEquals("5", IOUtils.readString(inf1));
        Assert.assertEquals("6", IOUtils.readString(inf1));

        Assert.assertEquals(1, inf1.available());
        Assert.assertEquals(-1, inf1.read());
        Assert.assertEquals(0, inf1.available());
    }

}
View Full Code Here

        byte[] deflated = { 72, -119, 99, 100, 102, 97, 3, 0, 0, 31, 0, 15, 0 };
        InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
        // InflaterInputStream.available() returns either 1 or 0, even though
        // that contradicts the behavior defined in InputStream.available()
        assertEquals(1, in.read());
        assertEquals(1, in.available());
        assertEquals(3, in.read());
        assertEquals(1, in.available());
        assertEquals(4, in.read());
        assertEquals(1, in.available());
        assertEquals(6, in.read());
View Full Code Here

        // InflaterInputStream.available() returns either 1 or 0, even though
        // that contradicts the behavior defined in InputStream.available()
        assertEquals(1, in.read());
        assertEquals(1, in.available());
        assertEquals(3, in.read());
        assertEquals(1, in.available());
        assertEquals(4, in.read());
        assertEquals(1, in.available());
        assertEquals(6, in.read());
        assertEquals(0, in.available());
        assertEquals(-1, in.read());
View Full Code Here

        assertEquals(1, in.read());
        assertEquals(1, in.available());
        assertEquals(3, in.read());
        assertEquals(1, in.available());
        assertEquals(4, in.read());
        assertEquals(1, in.available());
        assertEquals(6, in.read());
        assertEquals(0, in.available());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
    }
View Full Code Here

        assertEquals(3, in.read());
        assertEquals(1, in.available());
        assertEquals(4, in.read());
        assertEquals(1, in.available());
        assertEquals(6, in.read());
        assertEquals(0, in.available());
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
    }

    public void testAvailableSkip() throws Exception {
View Full Code Here

    public void testAvailableSkip() throws Exception {
        // this byte[] is a deflation of these bytes: { 1, 3, 4, 6 }
        byte[] deflated = { 72, -119, 99, 100, 102, 97, 3, 0, 0, 31, 0, 15, 0 };
        InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
        assertEquals(1, in.available());
        assertEquals(4, in.skip(4));
        assertEquals(0, in.available());
    }

    public void testAvailableEmptySource() throws Exception {
View Full Code Here

        // this byte[] is a deflation of these bytes: { 1, 3, 4, 6 }
        byte[] deflated = { 72, -119, 99, 100, 102, 97, 3, 0, 0, 31, 0, 15, 0 };
        InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
        assertEquals(1, in.available());
        assertEquals(4, in.skip(4));
        assertEquals(0, in.available());
    }

    public void testAvailableEmptySource() throws Exception {
        // this byte[] is a deflation of the empty file
        byte[] deflated = { 120, -100, 3, 0, 0, 0, 0, 1 };
View Full Code Here

        // this byte[] is a deflation of the empty file
        byte[] deflated = { 120, -100, 3, 0, 0, 0, 0, 1 };
        InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
        assertEquals(-1, in.read());
        assertEquals(-1, in.read());
        assertEquals(0, in.available());
    }

  /**
   * @tests java.util.zip.InflaterInputStream#read(byte[], int, int)
   */
 
View Full Code Here

    InflaterInputStream iis = new InflaterInputStream(is);

        int available;
        for (int i = 0; i < 11; i++) {
            iis.read();
            available = iis.available();
            if (available == 0) {
                assertEquals("Expected no more bytes to read", -1, iis.read());
            } else {
                assertEquals("Bytes Available Should Return 1.", 1, available);
            }
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.