Here you can find the source of unzip(byte[] output)
public static byte[] unzip(byte[] output)
//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 { private static final int BUFFER_SIZE = 256; public static byte[] unzip(byte[] output) { if (output == null || output.length == 0) { return output; }/* ww w . j a v a 2s . c o m*/ try { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(output); GZIPInputStream gunzip = new GZIPInputStream(in); byte[] buffer = new byte[BUFFER_SIZE]; int ret; while ((ret = gunzip.read(buffer)) >= 0) { out.write(buffer, 0, ret); } gunzip.close(); return out.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } }