Package java.util.zip

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


    }
    assertEquals("final decompressed data contained more bytes than original - inflateB",
        0, outPutInf[byteArray.length]);

    // test boundary checks
    inflate.reset();
    int r = 0;
    int offSet = 0;
    int lengthError = 101;
    try {
      if (inflate.needsInput()) {
View Full Code Here


                    int original_size=hdr.original_size;
                    byte[] uncompressed_payload=new byte[original_size];
                    Inflater inflater=null;
                    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 +
View Full Code Here

    }
    assertEquals("final decompressed data contained more bytes than original - inflateB",
        0, outPutInf[byteArray.length]);

    // test boundary checks
    inflate.reset();
    int r = 0;
    int offSet = 0;
    int lengthError = 101;
    try {
      if (inflate.needsInput()) {
View Full Code Here

    inflate.setInput(byteArray);
    assertFalse(
        "methodNeedsInput returned true when the input buffer is full",
        inflate.needsInput());

    inflate.reset();
    byte byteArrayEmpty[] = new byte[0];
    inflate.setInput(byteArrayEmpty);
    assertTrue(
        "needsInput give wrong boolean value as a result of an empty input buffer",
        inflate.needsInput());
View Full Code Here

        0, outPutInf[byteArray.length]);

    // testing that resetting the inflater will also return the correct
    // decompressed data

    inflate.reset();
    try {
      while (!(inflate.finished())) {
        if (inflate.needsInput()) {
          inflate.setInput(outPutBuff1);
        }
View Full Code Here

    inflate.setInput(byteArray, offSet, length);
    assertTrue(
        "setInputBII did not deliver the right number of bytes to the input buffer",
        inflate.getRemaining() == length);
    // boundary check
    inflate.reset();
    int r = 0;
    try {
      inflate.setInput(byteArray, 100, 100);
    } catch (ArrayIndexOutOfBoundsException e) {
      r = 1;
View Full Code Here

    int r = 0;
    Inflater inflate = new Inflater();
    inflate.setInput(byteArray);
    inflate.end();
    try {
      inflate.reset();
      inflate.setInput(byteArray);
    } catch (NullPointerException e) {
      r = 1;
    }
    assertEquals("inflate can still be used after end is called", 1, r);
View Full Code Here

    assertTrue(
        "the total number of bytes to be compressed does not equal the total bytes decompressed",
        inflate.getTotalOut() == deflate.getTotalIn());

    // testing inflate(byte,int,int)
    inflate.reset();
    y = 0;
    int offSet = 0;// seems only can start as 0
    int length = 4;
    try {
      while (!(inflate.finished())) {
View Full Code Here

        if(compressed_payload != null && compressed_payload.length > 0) {
            byte[] uncompressed_payload=new byte[original_size];
            Inflater inflater=null;
            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);
View Full Code Here

  /** {@inheritDoc} */ 
  public String getItem(String Key, int docid)
        throws IOException
    {
    Inflater unzip = inflaterCache.get();
    unzip.reset();
    unzip.setInput(dataSource.read(
      offsetLookup.getOffset(docid), offsetLookup.getLength(docid)
      ));
   
    byte[] bOut = new byte[recordLength];
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.