This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 415cd348a98a889aa999b6c5c60bcf8b9111bbb2 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Feb 4 10:40:59 2025 -0500 Sort members --- .../gzip/GzipCompressorInputStream.java | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java index 644cb2c06..b72be65e5 100644 --- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java @@ -72,8 +72,6 @@ */ public class GzipCompressorInputStream extends CompressorInputStream implements InputStreamStatistics { - private static final IOConsumer<GzipCompressorInputStream> NOOP = IOConsumer.noop(); - // @formatter:off /** * Builds a new {@link GzipCompressorInputStream}. @@ -192,6 +190,8 @@ public Builder setOnMemberStart(final IOConsumer<GzipCompressorInputStream> onMe } } + private static final IOConsumer<GzipCompressorInputStream> NOOP = IOConsumer.noop(); + /** * Constructs a new builder of {@link GzipCompressorInputStream}. * @@ -260,6 +260,19 @@ private static byte[] readToNull(final DataInput inData) throws IOException { private final IOConsumer<GzipCompressorInputStream> onMemberEnd; + @SuppressWarnings("resource") // caller closes + private GzipCompressorInputStream(final Builder builder) throws IOException { + countingStream = BoundedInputStream.builder().setInputStream(builder.getInputStream()).get(); + // Mark support is strictly needed for concatenated files only, + // but it's simpler if it is always available. + in = countingStream.markSupported() ? countingStream : new BufferedInputStream(countingStream); + this.decompressConcatenated = builder.decompressConcatenated; + this.fileNameCharset = builder.fileNameCharset; + this.onMemberStart = builder.onMemberStart != null ? builder.onMemberStart : NOOP; + this.onMemberEnd = builder.onMemberEnd != null ? builder.onMemberEnd : NOOP; + init(true); + } + /** * Constructs a new input stream that decompresses gzip-compressed data from the specified input stream. * <p> @@ -291,19 +304,6 @@ public GzipCompressorInputStream(final InputStream inputStream, final boolean de this(builder().setInputStream(inputStream).setDecompressConcatenated(decompressConcatenated)); } - @SuppressWarnings("resource") // caller closes - private GzipCompressorInputStream(final Builder builder) throws IOException { - countingStream = BoundedInputStream.builder().setInputStream(builder.getInputStream()).get(); - // Mark support is strictly needed for concatenated files only, - // but it's simpler if it is always available. - in = countingStream.markSupported() ? countingStream : new BufferedInputStream(countingStream); - this.decompressConcatenated = builder.decompressConcatenated; - this.fileNameCharset = builder.fileNameCharset; - this.onMemberStart = builder.onMemberStart != null ? builder.onMemberStart : NOOP; - this.onMemberEnd = builder.onMemberEnd != null ? builder.onMemberEnd : NOOP; - init(true); - } - /** * Closes the input stream (unless it is System.in). *