title: Compress an InputStream with gzip
body: <p>I would like to compress an input stream in java using Gzip compression.</p>
  
  <p>Let's say we have an input stream (1GB of data..) not compressed. I want as a result a compressed inputstream from the source :</p>
  
  <pre><code>public InputStream getCompressedStream(InputStream unCompressedStream) {
  
      // Not working because it's uncompressing the stream, I want the opposite.
      return new GZIPInputStream(unCompressedStream); 
  
  }
  </code></pre>