Here you can find the source of uncompressByteArray(byte[] ubytes, String type)
public static byte[] uncompressByteArray(byte[] ubytes, String type) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.*; import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; public class Main { public static byte[] uncompressByteArray(byte[] ubytes, String type) throws IOException { return uncompressAuxil(new ByteArrayInputStream(ubytes), type); }/*www .j a v a 2 s.c om*/ private static byte[] uncompressAuxil(InputStream input, String type) throws IOException { LinkedList<Byte> bytes = new LinkedList<Byte>(); FilterInputStream filterInput; if (type != null && type.equals("gzip")) { filterInput = new GZIPInputStream(input); } else if (type != null && type.equals("deflate")) { filterInput = new InflaterInputStream(input); } else { filterInput = new PushbackInputStream(input); } byte[] buf = new byte[1000]; int n; while ((n = filterInput.read(buf)) != -1) { for (int i = 0; i < n; i++) { bytes.add(buf[i]); } } int len = bytes.size(); byte[] ungzipBytes = new byte[len]; int j = 0; for (Byte b : bytes) { ungzipBytes[j++] = b; } return ungzipBytes; } }