Here you can find the source of ungzip(byte[] bytes)
public static String ungzip(byte[] bytes) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.util.zip.GZIPInputStream; public class Main { public static String ungzip(byte[] bytes) throws Exception { InputStreamReader isr = new InputStreamReader(new GZIPInputStream(new ByteArrayInputStream(bytes)), StandardCharsets.UTF_8); StringWriter sw = new StringWriter(); char[] chars = new char[1024]; for (int len; (len = isr.read(chars)) > 0;) { sw.write(chars, 0, len);//from ww w. ja v a 2s .co m } return sw.toString(); } }