Archie Cobbs created COMPRESS-685:
-------------------------------------
Summary: Javadoc for GzipCompressorInputStream contains
inaccuracies
Key: COMPRESS-685
URL: https://issues.apache.org/jira/browse/COMPRESS-685
Project: Commons Compress
Issue Type: Bug
Components: Compressors
Affects Versions: 1.26.2
Reporter: Archie Cobbs
There are two incorrect statements in the Javadoc for
{{GzipCompressorInputStream}}:
{quote}
If you use the constructor {{GzipCompressorInputStream(in)}} or
{{GzipCompressorInputStream(in, false)}} with some {{InputStream}} in then
{{read()}} will return -1 as soon as the first internal member has been read
completely. The stream in will be positioned at the start of the second gzip
member if there is one.
{quote}
That statement is only true if the configured input stream supports
{{mark()}}/{{reset()}}.
Otherwise not, an {{IOException}} may be thrown if/when {{reset()}} is invoked
on the input stream (or maybe not if you get lucky and the stars and read
buffering align).
{quote}
[{{GZIPInputStream}}|https://docs.oracle.com/javase/8/docs/api/java/util/zip/GZIPInputStream.html]
doesn't decompress concatenated .gz files: it stops after the first member and
silently ignores the rest.
{quote}
That statement was true a long time ago but is no longer true. This support was
added in JDK 7 (see [JDK-4691425|https://bugs.openjdk.org/browse/JDK-4691425]).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)