Here you can find the source of decompress(InputStream is, OutputStream os)
public static void decompress(InputStream is, OutputStream os) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.zip.InflaterInputStream; public class Main { private static final int BUFFER = 1024; public static void decompress(InputStream is, OutputStream os) throws Exception { InflaterInputStream gis = new InflaterInputStream(is); int count; byte data[] = new byte[BUFFER]; while ((count = gis.read(data, 0, BUFFER)) != -1) { os.write(data, 0, count);/*from w w w . j av a2 s . c o m*/ } gis.close(); } public static byte[] decompress(byte[] bt) throws Exception { ByteArrayInputStream is = new ByteArrayInputStream(bt); ByteArrayOutputStream os = new ByteArrayOutputStream(); decompress(is, os); return os.toByteArray(); } }