Search code examples
javagzipgzipinputstream

Gets the uncompressed size of this GZIPInputStream?


I have a GZIPInputStream that I constructed from another ByteArrayInputStream. I want to know the original (uncompressed) length for the gzip data. Although I can read to the end of the GZIPInputStream, then count the number, it will cost much time and waste CPU. I would like to know the size before read it.

Is there a similiar method like ZipEntry.getSize() for GZIPInputStream:

public long getSize ()
Since: API Level 1
Gets the uncompressed size of this ZipEntry.


Solution

  • Is there a similiar method like ZipEntry.getSize() for GZIPInputStream

    No. It's not in the Javadoc => it doesn't exist.

    What do you need the length for?