Here you can find the source of decompress(byte[] compressed)
public static final byte[] decompress(byte[] compressed) throws Exception
//package com.java2s; /**// ww w . java 2 s . c o m * Copyright 2008 ManyBrain, Inc. All Rights Reserved. Us is subject to * license Terms. * <p/> * Author: Paul Tyma * <p/> * This file is part of ManyBrain Memcached Java client. * <p/> * The ManyBrain Memcached Java client is free software; you can * redistribute it and/or modify * it under the terms of the Lesser GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * <p/> * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU * General Public License for more details. * <p/> * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. */ import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { public static final byte[] decompress(byte[] compressed) throws Exception { return decompress(compressed, 0, compressed.length); } public static final byte[] decompress(byte[] compressed, int off, int len) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(compressed, off, len); ZipInputStream zin = new ZipInputStream(in); ZipEntry entry = zin.getNextEntry(); byte[] buffer = new byte[1024]; int offset = -1; while ((offset = zin.read(buffer)) != -1) { out.write(buffer, 0, offset); } byte[] bb = out.toByteArray(); out.close(); zin.close(); return bb; } }