Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.DataFormatException; import java.util.zip.Inflater; public class Main { public static byte[] decompress(byte[] data) throws IOException, DataFormatException { Inflater inflater = new Inflater(); inflater.setInput(data); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length); byte[] buffer = new byte[1024]; while (!inflater.finished()) { int count = inflater.inflate(buffer); outputStream.write(buffer, 0, count); } outputStream.close(); byte[] output = outputStream.toByteArray(); /* LOG.debug("Original: " + data.length); LOG.debug("Compressed: " + output.length); */ return output; } }