Package java.util.zip

Examples of java.util.zip.Inflater.inflate()


      // seems no while loops allowed
      if (inflate2.needsInput()) {
        inflate2.setInput(outPutBuff1, offSet, length);
      }

      inflate2.inflate(outPutInf);

    } catch (DataFormatException e) {
      fail("Input to inflate is invalid or corrupted - getTotalIn");
    }
    // System.out.print(inflate2.getTotalIn() + " " + length);
View Full Code Here


      while (!(inflate.finished())) {
        if (inflate.needsInput()) {
          inflate.setInput(outPutBuf);
        }

        y += inflate.inflate(outPutInf);
      }
    } catch (DataFormatException e) {
      fail("Input to inflate is invalid or corrupted - getTotalIn");
    }
View Full Code Here

                            lenRead = query.remaining() < 1024 ? query.remaining() : 1024;
                            query.get(inBuffer, 0, lenRead);
                            decompressor.setInput(inBuffer, 0, lenRead);

                        int lenWrite = 0;
                        while ((lenWrite = decompressor.inflate(outBuffer)) !=0)
                            decompressed.write(outBuffer, 0, lenWrite);

                        if (decompressor.finished())
                            break;
                    }
View Full Code Here

            ByteArrayOutputStream bos = new ByteArrayOutputStream(body.length);
           
            // Inflate the compressed data
            byte[] buf = new byte[1024];
            while (!inflater.finished()) {
                int count = inflater.inflate(buf);
                bos.write(buf, 0, count);
            }

            String result = new String(bos.toByteArray(), "UTF-8");
           
View Full Code Here

        // Decompress the data
        byte[] buf = new byte[1024];
        while (!decompressor.finished())
        {
            int count = decompressor.inflate(buf);
            bos.write(buf, 0, count);
        }
        bos.close();

        // Get the decompressed data
View Full Code Here

                            lenRead = query.remaining() < 1024 ? query.remaining() : 1024;
                        query.get(inBuffer, 0, lenRead);
                        decompressor.setInput(inBuffer, 0, lenRead);

                        int lenWrite = 0;
                        while ((lenWrite = decompressor.inflate(outBuffer)) != 0)
                            decompressed.write(outBuffer, 0, lenWrite);

                        if (decompressor.finished())
                            break;
                    }
View Full Code Here

    public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) {
        Inflater decompresser = new Inflater();
        decompresser.setInput(in, inPos, inLen);
        decompresser.finished();
        try {
            int len = decompresser.inflate(out, outPos, outLen);
            if (len != outLen) {
                throw new DataFormatException(len + " " + outLen);
            }
        } catch (DataFormatException e) {
            throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);
View Full Code Here

                byte[] buffer = new byte[1024];
                Inflater decompresser = new Inflater();
                byteout = new ByteArrayOutputStream();
                decompresser.setInput(bytes);
                while (!decompresser.finished()) {
                    int count = decompresser.inflate(buffer);
                    byteout.write(buffer, 0, count);
                }
                byteout.close();
                decompresser.end();
View Full Code Here

            try {
                inflater=inflater_pool.take();
                inflater.reset();
                inflater.setInput(compressed_payload, msg.getOffset(), msg.getLength());
                try {
                    inflater.inflate(uncompressed_payload);
                    // we need to copy: https://jira.jboss.org/jira/browse/JGRP-867
                    return msg.copy(false).setBuffer(uncompressed_payload);
                }
                catch(DataFormatException e) {
                    log.error(Util.getMessage("CompressionFailure"), e);
View Full Code Here

      offsetLookup.getOffset(docid), offsetLookup.getLength(docid)
      ));
   
    byte[] bOut = new byte[recordLength];
    try {
      unzip.inflate(bOut);
    } catch(DataFormatException dfe) {
      logger.error(dfe);
    }
    return Text.decode(bOut, key2byteoffset.get(Key), key2bytelength.get(Key)).trim();
    }
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.