Here you can find the source of gzipDecompress(byte[] compressed)
public static String gzipDecompress(byte[] compressed) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.zip.GZIPInputStream; public class Main { public static String gzipDecompress(byte[] compressed) throws IOException { byte[] bytes = gzipDecompressBytes(compressed); return new String(bytes, StandardCharsets.UTF_8); }//from w w w. j ava 2 s .co m public static byte[] gzipDecompressBytes(byte[] compressed) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); final int BUFFER_SIZE = 32; ByteArrayInputStream is = new ByteArrayInputStream(compressed); GZIPInputStream gis = new GZIPInputStream(is, BUFFER_SIZE); byte[] data = new byte[BUFFER_SIZE]; int bytesRead; while ((bytesRead = gis.read(data)) != -1) { os.write(data, 0, bytesRead); } gis.close(); return os.toByteArray(); } }