Here you can find the source of unzip(byte[] zippedBytes)
public static byte[] unzip(byte[] zippedBytes) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.charset.Charset; import java.util.zip.GZIPInputStream; public class Main { public static byte[] unzip(byte[] zippedBytes) throws IOException { int sChunk = 8192; ByteArrayInputStream in = new ByteArrayInputStream(zippedBytes); GZIPInputStream zipin = new GZIPInputStream(in); byte[] buffer = new byte[sChunk]; ByteArrayOutputStream out = new ByteArrayOutputStream(); int length; while ((length = zipin.read(buffer, 0, sChunk)) != -1) out.write(buffer, 0, length); out.close();// w ww . j a va 2 s . c om zipin.close(); in.close(); return out.toByteArray(); } public static String unzip(byte[] zippedBytes, Charset charset) throws IOException { return new String(unzip(zippedBytes), charset); } }