Package java.util.zip

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


        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

        // construct the inflater object or reuse an existing one
        if (inflater == null)
            inflaterRef = new SoftReference<Inflater>(inflater = new Inflater(true));

        inflater.reset();
        inflater.setInput(src);
        try {
            return inflater.inflate(dest);
        } catch (DataFormatException ex) {
            return -1;
View Full Code Here

        {
            private final Inflater inflater = new Inflater();
           
            public byte[] code(byte[] data) throws Exception
            {
                inflater.reset();
                InflaterInputStream in = new InflaterInputStream(
                        new ByteArrayInputStream(data), inflater);
                ByteArrayOutputStream out = new ByteArrayOutputStream(data.length * 2);
                byte[] b = new byte[512];
                for(;;)
View Full Code Here

            inflater.finished();

            byte[] out = new byte[uncompressedSize];
            inflater.inflate(out);

            inflater.reset();
            return out;

        } catch (DataFormatException e) {
            throw new IOException("Input Stream is corrupt: " + e);
        }
View Full Code Here

        // should result in "info:" text if properly inflated
        byte rawbuf[] = TypeUtil.fromHexString("CaCc4bCbB70200"); // what pywebsocket produces
        // byte rawbuf[] = TypeUtil.fromHexString("CbCc4bCbB70200"); // what java produces

        Inflater inflater = new Inflater(true);
        inflater.reset();
        inflater.setInput(rawbuf, 0, rawbuf.length);

        byte outbuf[] = new byte[64];
        int len = inflater.inflate(outbuf);
        inflater.end();
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

    }

    public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException
    {
        Inflater inf = inflater.get();
        inf.reset();
        inf.setInput(input, inputOffset, inputLength);
        if (inf.needsInput())
            return 0;

        // We assume output is big enough
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.