Java Decompress Byte Array decompressData(byte[] compressedInput)

Here you can find the source of decompressData(byte[] compressedInput)

Description

decompress Data

License

Open Source License

Declaration

public static byte[] decompressData(byte[] compressedInput) throws DataFormatException, IOException 

Method Source Code

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

import java.io.*;

import java.util.zip.DataFormatException;

import java.util.zip.Inflater;

public class Main {
    public static byte[] decompressData(byte[] compressedInput) throws DataFormatException, IOException {
        Inflater decompressor = new Inflater();
        decompressor.setInput(compressedInput);
        ByteArrayOutputStream bos = new ByteArrayOutputStream(compressedInput.length);
        byte[] buffer = new byte[1024]; // Take chunks of 1024 byte data
        while (!decompressor.finished()) {
            int count = decompressor.inflate(buffer);
            bos.write(buffer, 0, count);
        }//from www.j  av  a  2s.c o  m
        bos.close();
        return bos.toByteArray();
    }
}

Related

  1. decompressByte(byte[] decompress)
  2. decompressByteArray(byte[] compressedData)
  3. decompressBytes(byte bytess[][])
  4. decompressBytes(byte[] input)
  5. decompressByZLIB(byte[] compressedBytes)
  6. decompressFolderByteArray(byte[] folderAsCompressedArray, File unzippedLocation)
  7. decompressGzip(byte[] compressed)
  8. decompressGZIP(byte[] data)
  9. decompressGzipByteArray(byte[] compressedByteArray)