Here you can find the source of decompress(byte[] source)
public static byte[] decompress(byte[] source) throws IOException
//package com.java2s; /**/*from w ww . ja v a 2 s .c o m*/ * Copyright (c) 2011, 2014 Eurotech and/or its affiliates * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Eurotech */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static byte[] decompress(byte[] source) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayInputStream bais = new ByteArrayInputStream(source); GZIPInputStream gzipis = null; try { gzipis = new GZIPInputStream(bais); int n; final int MAX_BUF = 1024; byte[] buf = new byte[MAX_BUF]; while ((n = gzipis.read(buf, 0, MAX_BUF)) != -1) { baos.write(buf, 0, n); } } catch (IOException e) { throw e; } finally { if (gzipis != null) { try { gzipis.close(); } catch (IOException e) { // Ignore } } try { baos.close(); } catch (IOException e) { // Ignore } } return baos.toByteArray(); } }