Java Decompress Byte Array decompress(byte[] bytes)

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

Description

decompress

License

Open Source License

Declaration

public static byte[] decompress(byte[] bytes) throws IOException 

Method Source Code


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

import java.io.*;

import java.util.zip.InflaterInputStream;

public class Main {
    public static byte[] decompress(byte[] bytes) throws IOException {
        try (InputStream in = new InflaterInputStream(new ByteArrayInputStream(bytes))) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buffer = new byte[4096];
            int len;
            while ((len = in.read(buffer)) > 0) {
                baos.write(buffer, 0, len);
            }//from  ww  w . j av a 2  s  . c  o m
            return baos.toByteArray();
        } catch (IOException e) {

            throw new AssertionError(e);
        }
    }
}

Related

  1. decompress(byte[] byteArray)
  2. decompress(byte[] bytes)
  3. decompress(byte[] bytes)
  4. Decompress(byte[] bytes)
  5. decompress(byte[] bytes)
  6. decompress(byte[] bytes)
  7. decompress(byte[] bytes, int bufferSize)
  8. decompress(byte[] compressed)