Package java.util.zip

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


    try {
      while (!(inflate.finished())) {
        if (inflate.needsInput()) {
          inflate.setInput(outPutBuff1);
        }
        y += inflate.inflate(outPutInf, y, outPutInf.length - y);
      }
    } catch (DataFormatException e) {
      fail("Invalid input to be decompressed");
    }
    for (int i = 0; i < byteArray.length; i++) {
View Full Code Here


    int lengthError = 101;
    try {
      if (inflate.needsInput()) {
        inflate.setInput(outPutBuff1);
      }
      inflate.inflate(outPutInf, offSet, lengthError);

    } catch (DataFormatException e) {
      fail("Invalid input to be decompressed");
    } catch (ArrayIndexOutOfBoundsException e) {
      r = 1;
View Full Code Here

        assertEquals(codedString, new String(result, 10, decLen));
        codedData[5] = 0;

        infl2.setInput(codedData, 0, codedData.length);
        try {
            decLen = infl2.inflate(result, 10, 11);
            fail("Expected DataFormatException");
        } catch (DataFormatException e) {
            // expected
        }
View Full Code Here

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

        inflate.inflate(outPutInf);
      }
      for (int i = 0; i < byteArray.length; i++) {
        assertEquals("the output array from inflate should contain 0 because the header of inflate and deflate did not match, but this failed",
            0, outPutBuff1[i]);
      }
View Full Code Here

    if (inflateDiction.needsInput()) {
      inflateDiction.setInput(outPutDiction);
    }
    try {
      assertEquals("should return 0 because needs dictionary",
          0, inflateDiction.inflate(outPutInf));
    } catch (DataFormatException e) {
      fail("Should not cause exception");
    }
    assertTrue(
        "method needsDictionary returned false when dictionary was used in deflater",
View Full Code Here

    // testing without dictionary
    Inflater inflate = new Inflater();
    try {
      inflate.setInput(outPutBuff1);
      inflate.inflate(outPutInf);
      assertFalse(
          "method needsDictionary returned true when dictionary was not used in deflater",
          inflate.needsDictionary());
    } catch (DataFormatException e) {
      fail(
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)
                            byteArray.write(outBuffer, 0, lenWrite);
                       
                        if (decompressor.finished())
                            break;
                    }
View Full Code Here

                    try {
                        inflater=inflater_pool.take();
                        inflater.reset();
                        inflater.setInput(compressed_payload, msg.getOffset(), msg.getLength());
                        try {
                            inflater.inflate(uncompressed_payload);
                            if(log.isTraceEnabled())
                                log.trace("uncompressed " + compressed_payload.length + " bytes to " + original_size +
                                        " bytes");
                            // we need to copy: https://jira.jboss.org/jira/browse/JGRP-867
                            Message copy=msg.copy(false);
View Full Code Here

    try {
      byte[] zipsrc = codec.decode(src);
      Inflater decompressor = new Inflater();
      byte[] uncompressed = new byte[zipsrc.length * 5];
      decompressor.setInput(zipsrc);
      int totalOut = decompressor.inflate(uncompressed);
      byte[] out = new byte[totalOut];
      System.arraycopy(uncompressed, 0, out, 0, totalOut);
      decompressor.end();
      return out;
    } catch (Exception e) {
View Full Code Here

           
            //get the real size of large message
            long sizeBody = newServerMessage.getLongProperty(Message.HDR_LARGE_BODY_SIZE);

            byte[] data = new byte[(int)sizeBody];
            inflater.inflate(data);
            inflater.end();
            qbuff.resetReaderIndex();
            qbuff.resetWriterIndex();
            qbuff.writeBytes(data);
         }
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.