Java Decompress Byte Array decompressByte(byte[] decompress)

Here you can find the source of decompressByte(byte[] decompress)

Description

decompress Byte

License

Open Source License

Declaration

public final static byte[] decompressByte(byte[] decompress) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;

import java.util.zip.Inflater;

public class Main {
    public final static byte[] decompressByte(byte[] decompress) throws Exception {
        return decompressByte(decompress, 0);
    }/*from   w w w . j  a v  a 2 s.  c om*/

    public final static byte[] decompressByte(byte[] decompress, int startInx) throws Exception {
        Inflater inflater = new Inflater();
        inflater.setInput(decompress, startInx, decompress.length - startInx);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        while (!inflater.finished()) {
            int count = inflater.inflate(buf);
            bos.write(buf, 0, count);
        }
        inflater.end();
        buf = bos.toByteArray();
        bos.close();
        return buf;
    }
}

Related

  1. decompress(byte[] str)
  2. decompress(byte[] zipByte)
  3. decompress(final byte[] compressed)
  4. decompress(final DataInputStream input, final byte[] result, int offset, int length)
  5. decompressAndB64DecodeUTF8Bytes(byte[] b64EncodedCompressedBytes)
  6. decompressByteArray(byte[] compressedData)
  7. decompressBytes(byte bytess[][])
  8. decompressBytes(byte[] input)
  9. decompressByZLIB(byte[] compressedBytes)