Package java.util.zip

Examples of java.util.zip.InflaterInputStream


        try {
            int length = chunk.getLength() - textIndex;
            byte[] data = chunk.getData();
            InputStream cis =
                new ByteArrayInputStream(data, textIndex, length);
            InputStream iis = new InflaterInputStream(cis);

            int c;
            while ((c = iis.read()) != -1) {
                value.append((char)c);
            }

            ztextKeys.add(key.toString());
            ztextStrings.add(value.toString());
View Full Code Here


        // Parse prior IDAT chunks
        InputStream seqStream =
            new SequenceInputStream( Collections.enumeration( streamVec ));
        InputStream infStream =
            new InflaterInputStream(seqStream, new Inflater());
        dataStream = new DataInputStream(infStream);

        // Create an empty WritableRaster
        int depth = bitDepth;
        if ((colorType == PNG_COLOR_GRAY) &&
            (bitDepth < 8) && output8BitGray) {
            depth = 8;
        }
        if ((colorType == PNG_COLOR_PALETTE) && expandPalette) {
            depth = 8;
        }
        int width  = bounds.width;
        int height = bounds.height;

        int bytesPerRow = (outputBands*width*depth + 7)/8;
        int scanlineStride =
            (depth == 16) ? (bytesPerRow/2) : bytesPerRow;

        theTile = createRaster(width, height, outputBands,
                               scanlineStride,
                               depth);

        if (performGammaCorrection && (gammaLut == null)) {
            initGammaLut(bitDepth);
        }
        if ((postProcess == POST_GRAY_LUT) ||
            (postProcess == POST_GRAY_LUT_ADD_TRANS) ||
            (postProcess == POST_GRAY_LUT_ADD_TRANS_EXP)) {
            initGrayLut(bitDepth);
        }

        decodeImage(interlaceMethod == 1);

        // Free resources associated with compressed data.
        dataStream.close();
        infStream.close();
        seqStream.close();
        streamVec = null;

        SampleModel sm = theTile.getSampleModel();
        ColorModel  cm;
View Full Code Here

        try {
            int length = chunk.getLength() - textIndex;
            byte[] data = chunk.getData();
            InputStream cis =
                new ByteArrayInputStream(data, textIndex, length);
            InputStream iis = new InflaterInputStream(cis);

            int c;
            while ((c = iis.read()) != -1) {
                value.append((char)c);
            }

            ztextKeys.add(key.toString() );
            ztextStrings.add(value.toString() );
View Full Code Here

   */
  public void test_ConstructorLjava_io_InputStreamLjava_util_zip_Inflater() throws IOException {
    byte byteArray[] = new byte[100];
    InputStream infile = Support_Resources.getStream("hyts_constru(OD).txt");
    Inflater inflate = new Inflater();
    InflaterInputStream inflatIP = new InflaterInputStream(infile,
        inflate);

    inflatIP.read(byteArray, 0, 5);// only suppose to read in 5 bytes
    inflatIP.close();
  }
View Full Code Here

  public void test_ConstructorLjava_io_InputStreamLjava_util_zip_InflaterI() throws IOException {
    int result = 0;
    int buffer[] = new int[500];
    InputStream infile = Support_Resources.getStream("hyts_constru(ODI).txt");
    Inflater inflate = new Inflater();
    InflaterInputStream inflatIP = new InflaterInputStream(infile,
        inflate, 1);

    int i = 0;
    while ((result = inflatIP.read()) != -1) {
      buffer[i] = result;
      i++;
    }
    inflatIP.close();
  }
View Full Code Here

    /**
     * @tests java.util.zip.InflaterInputStream#mark(int)
     */
    public void test_markI() {
        InputStream is = new ByteArrayInputStream(new byte[10]);
        InflaterInputStream iis = new InflaterInputStream(is);
        // mark do nothing, do no check
        iis.mark(0);
        iis.mark(-1);
        iis.mark(10000000);
    }
View Full Code Here

    /**
     * @tests java.util.zip.InflaterInputStream#markSupported()
     */
    public void test_markSupported() {
        InputStream is = new ByteArrayInputStream(new byte[10]);
        InflaterInputStream iis = new InflaterInputStream(is);
        assertFalse(iis.markSupported());
        assertTrue(is.markSupported());
    }
View Full Code Here

    int buffer[] = new int[500];
    byte orgBuffer[] = { 1, 3, 4, 7, 8 };
    InputStream infile = Support_Resources
        .getStream("hyts_constru(OD).txt");
    Inflater inflate = new Inflater();
    InflaterInputStream inflatIP = new InflaterInputStream(infile,
        inflate);

    int i = 0;
    while ((result = inflatIP.read()) != -1) {
      buffer[i] = result;
      i++;
    }
    inflatIP.close();

    for (int j = 0; j < orgBuffer.length; j++) {
      assertTrue(
        "original compressed data did not equal decompressed data",
        buffer[j] == orgBuffer[j]);
View Full Code Here

  }

    public void testAvailableNonEmptySource() 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));
        // 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());
        assertEquals(-1, in.read());
    }
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());
    }
View Full Code Here

TOP

Related Classes of java.util.zip.InflaterInputStream

Copyright © 2018 www.massapicom. 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.