Java tutorial
//package com.java2s; import java.io.*; import java.util.zip.GZIPInputStream; public class Main { public static String uncompress(String str) throws IOException { if (str == null || str.length() == 0) { return str; } 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(); } }