Here you can find the source of decompress(ByteBuffer buffer)
static public byte[] decompress(ByteBuffer buffer) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.util.zip.GZIPInputStream; public class Main { static public byte[] decompress(ByteBuffer buffer) throws IOException { return decompress(buffer.array()); }/*from w ww . j av a 2 s. c o m*/ static public byte[] decompress(byte[] bytes) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(bytes); GZIPInputStream gzipIn = new GZIPInputStream(bin); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = gzipIn.read(buf)) > 0) bos.write(buf, 0, len); return bos.toByteArray(); } }