Here you can find the source of uncompressByteArray(byte[] xmlByteArray)
public static byte[] uncompressByteArray(byte[] xmlByteArray) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPInputStream; public class Main { /**/*from w ww. j a v a2 s . c om*/ * 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(); } }