Java Ungzip Byte Array ungzip(byte[] bytes)

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

Description

ungzip

License

Open Source License

Declaration

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

Method Source Code

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

import java.io.*;

import java.util.zip.*;

public class Main {
    public static byte[] ungzip(byte[] bytes) throws IOException {
        ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        GZIPInputStream gis = new GZIPInputStream(bis);
        byte[] buffer = new byte[1024];
        int readed;
        while ((readed = gis.read(buffer)) > 0) {
            bos.write(buffer, 0, readed);
        }//from  ww w  .j  a  va  2s .  co  m
        return bos.toByteArray();
    }
}

Related

  1. unGZip(byte[] bContent)
  2. ungzip(byte[] buff)
  3. unGZip(byte[] bytes)
  4. unGzip(byte[] data)
  5. unGZip(byte[] data)
  6. ungzip(byte[] in)
  7. unGzip(byte[] str, String charset)