Java tutorial
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.zip.GZIPInputStream; public class Main { public static byte[] decompressInGzip(byte[] compressData) throws Exception { return decompressInGzip(compressData, 0, compressData.length); } public static byte[] decompressInGzip(byte[] compressData, int offset, int length) throws Exception { ByteArrayInputStream bis = new ByteArrayInputStream(compressData, offset, length); GZIPInputStream gzipInStream = new GZIPInputStream(bis); ByteArrayOutputStream bos = new ByteArrayOutputStream(); int count; byte[] buf = new byte[1024]; while ((count = gzipInStream.read(buf)) > 0) { bos.write(buf, 0, count); } gzipInStream.close(); byte[] originalData = bos.toByteArray(); bos.close(); return originalData; } }