Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.DataFormatException; import java.util.zip.Inflater; public class Main { public static byte[] decompress(byte[] compressedBuffer) { Inflater inflater = new Inflater(); inflater.setInput(compressedBuffer); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedBuffer.length); try { byte[] buffer = new byte[1024]; while (!inflater.finished()) { int count = inflater.inflate(buffer); outputStream.write(buffer, 0, count); } byte[] output = outputStream.toByteArray(); return output; } catch (DataFormatException e) { throw new RuntimeException(e); } finally { try { inflater.end(); outputStream.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }