Here you can find the source of ungzipPayload(byte[] compressed)
public static String ungzipPayload(byte[] compressed)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; public class Main { public static String ungzipPayload(byte[] compressed) { try {//w ww . j a v a 2 s .co m if ((compressed == null) || (compressed.length == 0)) { throw new RuntimeException("Null/empty compressed payload. is_null=" + (compressed == null)); } final StringBuilder outStr = new StringBuilder(); final GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressed)); final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gis, "UTF-8")); String line; while ((line = bufferedReader.readLine()) != null) { outStr.append(line); } return outStr.toString(); } catch (IOException ex) { throw new RuntimeException(ex); } } }