Code example for ByteArrayEntity

Methods: setContentEncoding

0
    } else { 
      ByteArrayOutputStream arr = new ByteArrayOutputStream();
      OutputStream zipper = new GZIPOutputStream(arr);
      zipper.write(data);
      zipper.close();
      entity = new ByteArrayEntity(arr.toByteArray());
      entity.setContentEncoding("gzip");
    } 
    return entity;
  } 
 
  /** 
   * Retrieves the minimum size for compressing data. 
   * Shorter data will not be compressed. 
   */ 
  public static long getMinGzipSize() { 
    return DEFAULT_SYNC_MIN_GZIP_BYTES;
  } 
 
  /* cURL logging support. */