Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPInputStream; public class Main { /** * uncompress the xmlByteArray */ public static byte[] uncompressByteArray(byte[] xmlByteArray) throws IOException { byte[] tmp = new byte[2048]; int byteCount = 0; ByteArrayOutputStream uncompressedData = new ByteArrayOutputStream(); GZIPInputStream gzipIS = new GZIPInputStream(new ByteArrayInputStream(xmlByteArray)); while ((byteCount = gzipIS.read(tmp)) != -1) { uncompressedData.write(tmp, 0, byteCount); } return uncompressedData.toByteArray(); } }