title: Reading a Gzip file of an Unknown length in Java
body: <p>I have requirement to downlad a file from s3 which is in .gz format.
  I can very well do that</p>
  
  <pre><code>BufferedInputStream bufferedInputStream = new BufferedInputStream( new GZIPInputStream(fileObj.getObjectContent()));
  </code></pre>
  
  <p>Now, to read content of this file I might have to do something like this </p>
  
  <pre><code>    int n;
      byte[] buffer = new byte[1024];
       while ((n = bufferedInputStream.read(buffer)) != -1) {
       }
  </code></pre>
  
  <p>However I do not know the size of my original .gz file.</p>
  
  <p>It might be said that I might get size from some API of aws-s3-sdk.
  But Still I think there must be a better way.</p>
  
  <p>Also, I need to do this uncompression really fast. Is there any equivalent of Parallel Streaming which I can perform on GZIPInputStream?</p>