Here you can find the source of uncompress(InputStream inputStream)
public static String uncompress(InputStream inputStream) 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.io.InputStream; import java.util.zip.GZIPInputStream; public class Main { public static String uncompress(String str) throws IOException { if (str == null || str.length() == 0) { return str; }//from ww w .j a v a2s . com ByteArrayInputStream in = new ByteArrayInputStream( str.getBytes("UTF-8")); return uncompress(in); } public static String uncompress(InputStream inputStream) throws IOException { if (inputStream == null) { return null; } ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPInputStream gunzip = new GZIPInputStream(inputStream); byte[] buffer = new byte[256]; int n; while ((n = gunzip.read(buffer)) >= 0) { out.write(buffer, 0, n); } return out.toString(); } }