Here you can find the source of decompress(byte[] data, int off, int len)
public static byte[] decompress(byte[] data, int off, int len)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.util.zip.Inflater; public class Main { public static byte[] decompress(byte[] data, int off, int len) { byte[] output = null; Inflater decompresser = new Inflater(); decompresser.reset();/*from w w w. j a va 2s . c o m*/ decompresser.setInput(data, off, len); ByteArrayOutputStream out = new ByteArrayOutputStream(data.length); try { byte[] result = new byte[1024]; while (!decompresser.finished()) { int i = decompresser.inflate(result); out.write(result, 0, i); } output = out.toByteArray(); } catch (Exception e) { throw new RuntimeException(e); } finally { try { out.close(); } catch (Exception e) { } decompresser.end(); } return output; } }