Package java.util.zip

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


    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 {
        // this byte[] is a deflation of the empty file
View Full Code Here


    InputStream is = Support_Resources.getStream("hyts_available.tst");
    InflaterInputStream iis = new InflaterInputStream(is);

    // Tests for skipping a negative number of bytes.
    try {
      iis.skip(-3);
      fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 5, iis.read());
View Full Code Here

            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 5, iis.read());

    try {
      iis.skip(Integer.MIN_VALUE);
      fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 4, iis.read());
View Full Code Here

            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 4, iis.read());

    // Test to make sure the correct number of bytes were skipped
    assertEquals("Incorrect Number Of Bytes Skipped.", 3, iis.skip(3));

    // Test to see if the number of bytes skipped returned is true.
    assertEquals("Incorrect Byte Returned.", 7, iis.read());

    assertEquals("Incorrect Number Of Bytes Skipped.", 0, iis.skip(0));
View Full Code Here

    assertEquals("Incorrect Number Of Bytes Skipped.", 3, iis.skip(3));

    // Test to see if the number of bytes skipped returned is true.
    assertEquals("Incorrect Byte Returned.", 7, iis.read());

    assertEquals("Incorrect Number Of Bytes Skipped.", 0, iis.skip(0));
    assertEquals("Incorrect Byte Returned.", 0, iis.read());

    // Test for skipping more bytes than available in the stream
    assertEquals("Incorrect Number Of Bytes Skipped.", 2, iis.skip(4));
    assertEquals("Incorrect Byte Returned.", -1, iis.read());
View Full Code Here

    assertEquals("Incorrect Number Of Bytes Skipped.", 0, iis.skip(0));
    assertEquals("Incorrect Byte Returned.", 0, iis.read());

    // Test for skipping more bytes than available in the stream
    assertEquals("Incorrect Number Of Bytes Skipped.", 2, iis.skip(4));
    assertEquals("Incorrect Byte Returned.", -1, iis.read());
    iis.close();
  }

  /**
 
View Full Code Here

    Inflater inflate = new Inflater();
    InflaterInputStream inflatIP = new InflaterInputStream(infile,
        inflate, 10);
    long skip;
    try {
      skip = inflatIP.skip(Integer.MIN_VALUE);
      fail("Expected IllegalArgumentException when skip() is called with negative parameter");
    } catch (IllegalArgumentException e) {
            // Expected
    }
    inflatIP.close();
View Full Code Here

    InflaterInputStream inflatIP2 = new InflaterInputStream(infile2);

    // looked at how many bytes the skip skipped. It is
    // 5 and its supposed to be the entire input stream.

    skip = inflatIP2.skip(Integer.MAX_VALUE);
    // System.out.println(skip);
    assertEquals("method skip() returned wrong number of bytes skipped",
        5, skip);

    // test for skipping of 2 bytes
View Full Code Here

    // test for skipping of 2 bytes
    InputStream infile3 = Support_Resources
        .getStream("hyts_constru(OD).txt");
    InflaterInputStream inflatIP3 = new InflaterInputStream(infile3);
    skip = inflatIP3.skip(2);
    assertEquals("the number of bytes returned by skip did not correspond with its input parameters",
        2, skip);
    int i = 0;
    result = 0;
    while ((result = inflatIP3.read()) != -1) {
View Full Code Here

            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 5, iis.read());

    try {
      iis.skip(Integer.MIN_VALUE);
      fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
            // Expected
    }
    assertEquals("Incorrect Byte Returned.", 4, iis.read());
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.