Here you can find the source of ungzip(byte[] bytes)
public static byte[] ungzip(byte[] bytes) throws IOException
//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(); } }