Package java.util.zip

Examples of java.util.zip.InflaterInputStream


      if (len != 0)
        throw new IOException("expected no headers");
     
      _bodyIn = _in.readInputStream();

      _inflateIn = new InflaterInputStream(_bodyIn);
    }
View Full Code Here


        COSDictionary dict = (COSDictionary) options.getDictionaryObject("DecodeParms");
        int predictor = -1;
        int colors = -1;
        int bitsPerPixel = -1;
        int columns = -1;
        InflaterInputStream decompressor = null;
        ByteArrayInputStream bais = null;
        ByteArrayOutputStream baos = null;
        if (dict!=null)
        {
            predictor = dict.getInt("Predictor");
            colors = dict.getInt("Colors");
            bitsPerPixel = options.getInt("BitsPerComponent");
            columns = dict.getInt("Columns");
        }

        try
        {
            // Decompress data to temporary ByteArrayOutputStream
            decompressor = new InflaterInputStream(compressedData);
            byte[] buffer = new byte[BUFFER_SIZE];
            int amountRead;

            // Decode data using given predictor
            if (predictor==-1 || predictor == 1 && predictor == 10)
            {
                // decoding not needed
                while ((amountRead = decompressor.read(buffer, 0, BUFFER_SIZE)) != -1)
                {
                    result.write(buffer, 0, amountRead);
                }
            }
            else
            {
                if (colors==-1 || bitsPerPixel==-1 || columns==-1)
                {
                    throw new IOException("Could not read all parameters to decode image");
                }
               
                baos = new ByteArrayOutputStream();
                while ((amountRead = decompressor.read(buffer, 0, BUFFER_SIZE)) != -1)
                {
                    baos.write(buffer, 0, amountRead);
                }
                baos.flush();

                // Copy data to ByteArrayInputStream for reading
                bais = new ByteArrayInputStream(baos.toByteArray());
                baos.close();
                baos = null;

                byte[] decodedData = decodePredictor(predictor, colors, bitsPerPixel, columns, bais);
                bais.close();
                bais = new ByteArrayInputStream(decodedData);

                // write decoded data to result
                while ((amountRead = bais.read(buffer)) != -1)
                {
                    result.write(buffer, 0, amountRead);
                }
                bais.close();
                bais = null;
            }           
           
           
            result.flush();
        }
        finally
        {
            if (decompressor != null)
            {
                decompressor.close();
            }
            if (bais != null)
            {
                bais.close();
            }
View Full Code Here

      out.close();

      InputStream is = os.openInputStream();

      try {
        InflaterInputStream gzIn = new InflaterInputStream(is);

        Object value = serializer.deserialize(gzIn);

        gzIn.close();

        return value;
      } finally {
        is.close();
      }
View Full Code Here

        if (object == null && getContent() != null) {
            try {
                Buffer content = getContent();
                InputStream is = new ByteArrayInputStream(content);
                if (isCompressed()) {
                    is = new InflaterInputStream(is);
                }
                DataInputStream dataIn = new DataInputStream(is);
                ClassLoadingAwareObjectInputStream objIn = new ClassLoadingAwareObjectInputStream(dataIn);
                try {
                    object = (Serializable)objIn.readObject();
View Full Code Here

        try {
            if (getContent() != null && map.isEmpty()) {
                Buffer content = getContent();
                InputStream is = new ByteArrayInputStream(content);
                if (isCompressed()) {
                    is = new InflaterInputStream(is);
                }
                DataInputStream dataIn = new DataInputStream(is);
                map = MarshallingSupport.unmarshalPrimitiveMap(dataIn);
                dataIn.close();
            }
View Full Code Here

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

        // Create an empty WritableRaster
        int depth = bitDepth;
        if ((colorType == PNG_COLOR_GRAY) &&
View Full Code Here

        }

  data[pos] = 0;
  String name = new String(data);
  byte compMethod = chunk.getByte(pos++);
  InflaterInputStream infls = new InflaterInputStream(
                                        new ByteArrayInputStream(
                                            chunk.getData(), pos,
                                            chunk.getLength() - pos
                                        )
                                    );
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 += (char)c;
            }

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

     * @return A string containing the decompressed data
     */
    public static String decompressZlib(byte[] compressedData) throws IOException {
        byte[] buffer = new byte[compressedData.length];
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        InflaterInputStream in = new InflaterInputStream(new ByteArrayInputStream(compressedData));
        for (int bytesRead = 0; bytesRead != -1; bytesRead = in.read(buffer)) {
            out.write(buffer, 0, bytesRead);
        }
        return new String(out.toByteArray(), StandardCharsets.UTF_8);
    }
View Full Code Here

            byte[] decodedMessage = Base64.decode(samlMessage);
            is = new ByteArrayInputStream(decodedMessage);
        } else {
            byte[] base64Decoded = Base64.decode(samlMessage);
            ByteArrayInputStream bais = new ByteArrayInputStream(base64Decoded);
            is = new InflaterInputStream(bais, new Inflater(true));
        }

        Document document = getDocument(is);
        String issuerEntityId;
        RequestAbstractType samlRequestMessage = null;
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.