Package java.util.zip

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


        // 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


    int available;
    int read;
    for (int i = 0; i < 11; i++) {
      read = iis.read();
      available = iis.available();
      if (read == -1) {
                assertEquals("Bytes Available Should Return 0 ",
            0, available);
            } else {
                assertEquals("Bytes Available Should Return 1.",
View Full Code Here

            }
    }

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

    InflaterInputStream inflater = new InflaterInputStream(data.asInputStream());
    byte[] buffer = new byte[8192];
    ByteBuffer tmp = ByteBuffer.allocate(0);
    tmp.setAutoExpand(true);
    try {
      while (inflater.available() > 0) {
        int decompressed = inflater.read(buffer);
        if (decompressed <= 0) {
          // Finished decompression
          break;
        }
View Full Code Here

  {
    StringBuffer result = new StringBuffer();
    InputStream in = new InflaterInputStream(new ByteArrayInputStream(
        binary), new Inflater(true));

    while (in.available() != 0)
    {
      byte[] buffer = new byte[IO_BUFFER_SIZE];
      int len = in.read(buffer, 0, IO_BUFFER_SIZE);

      if (len <= 0)
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.