public static byte[] flateDecode(byte[] in,boolean strict){
  ByteArrayInputStream stream=new ByteArrayInputStream(in);
  InflaterInputStream zip=new InflaterInputStream(stream);
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  byte[] b=new byte[strict ? 4092 : 1];
  try {
    int n;
    while ((n=zip.read(b)) >= 0) {
      out.write(b,0,n);
    }
    zip.close();
    out.close();
    return out.toByteArray();
  }
 catch (  Exception e) {
    if (strict)     return null;
    return out.toByteArray();
  }
}

public static byte [ ] flateDecode ( byte [ ] in , boolean strict ) { ByteArrayInputStream stream = new ByteArrayInputStream ( in ) ; InflaterInputStream zip = new InflaterInputStream ( stream ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; byte [ ] b = new byte [ strict ? 4092 : 1 ] ; try { int n ; while ( ( n = zip . read ( b ) ) >= 0 ) { out . write ( b , 0 , n ) ; } zip . close ( ) ; out . close ( ) ; return out . toByteArray ( ) ; } catch ( Exception e ) { if ( strict ) return null ; return out . toByteArray ( ) ; } }
a helper to flatedecode .
