Here you can find the source of deflateGzip(final byte[] bts)
public static final byte[] deflateGzip(final byte[] bts) throws IOException
//package com.java2s; //License from project: Apache License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static final byte[] deflateGzip(final byte[] bts) throws IOException { final int buffLen = 2 * bts.length; final GZIPInputStream in = new GZIPInputStream( new ByteArrayInputStream(bts)); final ByteArrayOutputStream out = new ByteArrayOutputStream(buffLen); int len = 0; final byte[] buff = new byte[buffLen]; try {/*w w w. ja va 2 s .c o m*/ while ((len = in.read(buff)) > 0) out.write(buff, 0, len); } finally { in.close(); } return out.toByteArray(); } }