Here you can find the source of unGZip(byte[] bContent)
public static byte[] unGZip(byte[] bContent) throws IOException
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { private static final int MAXLENGTH = 102400; private static final int BUFFERSIZE = 1024; public static byte[] unGZip(byte[] bContent) throws IOException { byte[] data = new byte[MAXLENGTH]; try {/*from ww w . j av a2 s . c o m*/ ByteArrayInputStream in = new ByteArrayInputStream(bContent); GZIPInputStream pIn = new GZIPInputStream(in); DataInputStream objIn = new DataInputStream(pIn); int len = 0; int count = 0; while ((count = objIn.read(data, len, len + BUFFERSIZE)) != -1) { len = len + count; } byte[] trueData = new byte[len]; System.arraycopy(data, 0, trueData, 0, len); objIn.close(); pIn.close(); in.close(); return trueData; } catch (IOException e) { e.printStackTrace(); throw e; } } }