Code example for Deflater

Methods: deflate, end, finish, setInput

0
  /** 
   * Deflate the input into the output array, returning the number of bytes 
   * written to output. 
   */ 
  public static int deflate(byte[] input, byte[] output) {
    final Deflater deflater = new Deflater();
    deflater.setInput(input);
    deflater.finish();
 
    final int length = deflater.deflate(output);
    deflater.end();
    return length;
  } 
 
  /** 
   * Deflate the input, returning an HttpEntity that offers an accurate window 
   * on the output. 
   * 
   * Note that this method does not trim the output array. (Test code can use 
   * {@link TestDeflation#deflateTrimmed(byte[])}.) 
   *