Package java.util.zip

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


            }
        }

    iis.close();
    try {
      iis.available();
      fail("available after close should throw IOException.");
    } catch (IOException e) {
            // Expected
    }
  }
View Full Code Here


   */
  public void load(final InputStream stream) throws IOException {
    InputStream zip = new InflaterInputStream(stream);
    zip = new BufferedInputStream(zip);
    size = 0;
    while (zip.available() > 0) {
      final char c = (char) (zip.read() + (zip.read() << 8));
      checkSize(size + 1);
      tree[size++] = c;
    }
    zip.close();
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

            }
        }

    iis.close();
    try {
      iis.available();
      fail("available after close should throw IOException.");
    } catch (IOException e) {
            // Expected
    }
  }
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

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.