Java: How do I know the size of InputStream?
<ul>
<li>My code gets the <code>inputStream</code>, zip using <code>GZIP</code> and send it to Amazons S3</li>
<li>I would like to log message where I would like to print "size before" = <code>size of InputStream</code>and size after = <code>size after GZip</code> is applied</li>
</ul>

<p>Here's my code:</p>

<pre><code>public void putStream(@Nonnull final String uniqueId, @Nonnull final InputStream inputStream) throws PersistenceException {

    final byte[] byteArrayOutputStream;
         final long startTime = new Date().getTime();
         try {
             byteArrayOutputStream = readFully(inputStream);
         } catch (IOException e) {
             throw new PersistenceException("Failed to slurp " + uniqueId + ": " + e.getMessage(), e);
         }

         final ObjectMetadata metadata = new ObjectMetadata();
         metadata.setContentLength(byteArrayOutputStream.length);
         metadata.setContentType("binary/octet-stream");
         metadata.setContentEncoding("gzip");

         final InputStream gzipInputStream = new ByteArrayInputStream(byteArrayOutputStream);
         try {
             amazonS3Client.putObject(new PutObjectRequest(bucketName, getPathFromDocumentId(uniqueId), 
                 gzipInputStream, metadata));
         } catch (AmazonS3Exception e) {
             if (e.getStatusCode() == 403) {
                 throw new PersistenceException("Object already exists or User does not permission to put " + uniqueId, e);
             }
             throw new PersistenceException("S3 rejected " + uniqueId, e);
         }
         final long endTime = new Date().getTime();
         LOGGER.debug(uniqueId + ":" + );
    }
</code></pre>

<ul>
<li>How can I know the size of <code>inputStream</code> here?</li>
</ul>
