public static final byte[] unzip(byte[] in) throws IOException {
  ByteArrayOutputStream outStream=new ByteArrayOutputStream(EXPECTED_COMPRESSION_RATIO * in.length);
  GZIPInputStream inStream=new GZIPInputStream(new ByteArrayInputStream(in));
  byte[] buf=new byte[BUF_SIZE];
  while (true) {
    int size=inStream.read(buf);
    if (size <= 0)     break;
    outStream.write(buf,0,size);
  }
  outStream.close();
  return outStream.toByteArray();
}

public static final byte [ ] unzip ( byte [ ] in ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( EXPECTED_COMPRESSION_RATIO * in . length ) ; GZIPInputStream inStream = new GZIPInputStream ( new ByteArrayInputStream ( in ) ) ; byte [ ] buf = new byte [ BUF_SIZE ] ; while ( true ) { int size = inStream . read ( buf ) ; if ( size <= 0 ) break ; outStream . write ( buf , 0 , size ) ; } outStream . close ( ) ; return outStream . toByteArray ( ) ; }
returns an gunzipped copy of the input array .
