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 90adadf003e8944cde6559921b58fc3f208045e1
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Sep 16 17:33:10 2025 -0400

    Sort members
---
 .../compress/archivers/ArchiveInputStream.java     |  36 ++---
 .../archivers/ar/ArArchiveInputStream.java         |  28 ++--
 .../archivers/arj/ArjArchiveInputStream.java       |  50 +++---
 .../archivers/cpio/CpioArchiveInputStream.java     |  54 +++----
 .../archivers/dump/DumpArchiveInputStream.java     |  52 +++---
 .../archivers/jar/JarArchiveInputStream.java       |  24 +--
 .../archivers/tar/TarArchiveInputStream.java       |  16 +-
 .../archivers/zip/ZipArchiveInputStream.java       | 180 ++++++++++-----------
 .../commons/compress/harmony/pack200/IntList.java  |   8 +-
 .../archivers/tar/TarArchiveInputStreamTest.java   |  14 +-
 10 files changed, 231 insertions(+), 231 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java 
b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
index 2a97a14ed..73c4dbefd 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/ArchiveInputStream.java
@@ -52,6 +52,24 @@
  */
 public abstract class ArchiveInputStream<E extends ArchiveEntry> extends 
FilterInputStream {
 
+    /**
+     * Generic builder for ArchiveInputStream instances.
+     *
+     * @param <T> The type of {@link ArchiveInputStream} to build.
+     * @param <B> The type of the concrete AbstractBuilder.
+     * @since 1.29.0
+     */
+    public abstract static class AbstractBuilder<T extends 
ArchiveInputStream<?>, B extends AbstractBuilder<T, B>>
+            extends AbstractStreamBuilder<T, B> {
+
+        /**
+         * Constructs a new instance.
+         */
+        protected AbstractBuilder() {
+            // empty
+        }
+    }
+
     /**
      * An iterator over a collection of a specific {@link ArchiveEntry} type.
      */
@@ -89,24 +107,6 @@ public Iterator<E> unwrap() {
 
     }
 
-    /**
-     * Generic builder for ArchiveInputStream instances.
-     *
-     * @param <T> The type of {@link ArchiveInputStream} to build.
-     * @param <B> The type of the concrete AbstractBuilder.
-     * @since 1.29.0
-     */
-    public abstract static class AbstractBuilder<T extends 
ArchiveInputStream<?>, B extends AbstractBuilder<T, B>>
-            extends AbstractStreamBuilder<T, B> {
-
-        /**
-         * Constructs a new instance.
-         */
-        protected AbstractBuilder() {
-            // empty
-        }
-    }
-
     private static final int BYTE_MASK = 0xFF;
 
     private final byte[] single = new byte[1];
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
index 5aa2b7776..d9d3ad899 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
@@ -82,6 +82,16 @@ public ArArchiveInputStream get() throws IOException {
     private static final String GNU_STRING_TABLE_NAME = "//";
     private static final Pattern GNU_LONGNAME_PATTERN = 
Pattern.compile("^/\\d+");
 
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
     /**
      * Does the name look like it is a long name (or a name containing spaces) 
as encoded by BSD ar?
      * <p>
@@ -137,16 +147,6 @@ public static boolean matches(final byte[] buffer, final 
int ignored) {
         return ArrayUtils.startsWith(buffer, ArArchiveEntry.HEADER_BYTES);
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     private boolean closed;
 
     /*
@@ -165,6 +165,10 @@ public static Builder builder() {
     /** Cached buffer for meta data - must only be used locally in the class 
(COMPRESS-172 - reduce garbage collection). */
     private final byte[] metaData = new byte[NAME_LEN + LAST_MODIFIED_LEN + 
USER_ID_LEN + GROUP_ID_LEN + FILE_MODE_LEN + LENGTH_LEN];
 
+    private ArArchiveInputStream(final Builder builder) throws IOException {
+        this(builder.getInputStream(), builder);
+    }
+
     /**
      * Constructs an Ar input stream with the referenced stream
      *
@@ -174,10 +178,6 @@ public ArArchiveInputStream(final InputStream inputStream) 
{
         this(inputStream, builder());
     }
 
-    private ArArchiveInputStream(final Builder builder) throws IOException {
-        this(builder.getInputStream(), builder);
-    }
-
     private ArArchiveInputStream(final InputStream inputStream, final Builder 
builder) {
         super(inputStream, builder.getCharset());
     }
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
index 8bf783e43..34dedaa06 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
@@ -75,6 +75,16 @@ public ArjArchiveInputStream get() throws IOException {
     private static final int ARJ_MAGIC_1 = 0x60;
     private static final int ARJ_MAGIC_2 = 0xEA;
 
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
     /**
      * Checks if the signature matches what is expected for an arj file.
      *
@@ -86,21 +96,15 @@ public static boolean matches(final byte[] signature, final 
int length) {
         return length >= 2 && (0xff & signature[0]) == ARJ_MAGIC_1 && (0xff & 
signature[1]) == ARJ_MAGIC_2;
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     private final DataInputStream dis;
     private final MainHeader mainHeader;
     private LocalFileHeader currentLocalFileHeader;
     private InputStream currentInputStream;
 
+    private ArjArchiveInputStream(final Builder builder) throws IOException {
+        this(builder.getInputStream(), builder);
+    }
+
     /**
      * Constructs the ArjInputStream, taking ownership of the inputStream that 
is passed in, and using the CP437 character encoding.
      *
@@ -111,21 +115,6 @@ public ArjArchiveInputStream(final InputStream 
inputStream) throws ArchiveExcept
         this(inputStream, builder());
     }
 
-    /**
-     * Constructs the ArjInputStream, taking ownership of the inputStream that 
is passed in.
-     *
-     * @param inputStream the underlying stream, whose ownership is taken
-     * @param charsetName the charset used for file names and comments in the 
archive. May be {@code null} to use the platform default.
-     * @throws ArchiveException if an exception occurs while reading
-     */
-    public ArjArchiveInputStream(final InputStream inputStream, final String 
charsetName) throws ArchiveException {
-        this(inputStream, builder().setCharset(charsetName));
-    }
-
-    private ArjArchiveInputStream(final Builder builder) throws IOException {
-        this(builder.getInputStream(), builder);
-    }
-
     private ArjArchiveInputStream(final InputStream inputStream, final Builder 
builder) throws ArchiveException {
         super(new DataInputStream(inputStream), builder.getCharset());
         dis = (DataInputStream) in;
@@ -142,6 +131,17 @@ private ArjArchiveInputStream(final InputStream 
inputStream, final Builder build
         }
     }
 
+    /**
+     * Constructs the ArjInputStream, taking ownership of the inputStream that 
is passed in.
+     *
+     * @param inputStream the underlying stream, whose ownership is taken
+     * @param charsetName the charset used for file names and comments in the 
archive. May be {@code null} to use the platform default.
+     * @throws ArchiveException if an exception occurs while reading
+     */
+    public ArjArchiveInputStream(final InputStream inputStream, final String 
charsetName) throws ArchiveException {
+        this(inputStream, builder().setCharset(charsetName));
+    }
+
     @Override
     public boolean canReadEntryData(final ArchiveEntry ae) {
         return ae instanceof ArjArchiveEntry && ((ArjArchiveEntry) 
ae).getMethod() == LocalFileHeader.Methods.STORED;
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
index 8479650fe..5aa93b54a 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
@@ -86,6 +86,11 @@ private Builder() {
             setCharset(CpioUtil.DEFAULT_CHARSET);
         }
 
+        @Override
+        public CpioArchiveInputStream get() throws IOException {
+            return new CpioArchiveInputStream(this);
+        }
+
         /**
          * Sets the block size of the archive.
          * <p>
@@ -99,11 +104,16 @@ public Builder setBlockSize(final int blockSize) {
             this.blockSize = blockSize;
             return asThis();
         }
+    }
 
-        @Override
-        public CpioArchiveInputStream get() throws IOException {
-            return new CpioArchiveInputStream(this);
-        }
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder builder() {
+        return new Builder();
     }
 
     /**
@@ -159,16 +169,6 @@ public static boolean matches(final byte[] signature, 
final int length) {
         return false;
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     private boolean closed;
 
     private CpioArchiveEntry entry;
@@ -196,6 +196,10 @@ public static Builder builder() {
      */
     private final ZipEncoding zipEncoding;
 
+    private CpioArchiveInputStream(final Builder builder) throws IOException {
+        this(builder.getInputStream(), builder);
+    }
+
     /**
      * Constructs the cpio input stream with a blocksize of {@link 
CpioConstants#BLOCK_SIZE BLOCK_SIZE} and expecting ASCII file names.
      *
@@ -205,6 +209,15 @@ public CpioArchiveInputStream(final InputStream in) {
         this(in, builder());
     }
 
+    private CpioArchiveInputStream(final InputStream in, final Builder 
builder) {
+        super(in, builder.getCharset());
+        if (builder.blockSize <= 0) {
+            throw new IllegalArgumentException("blockSize must be bigger than 
0");
+        }
+        this.blockSize = builder.blockSize;
+        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
+    }
+
     /**
      * Constructs the cpio input stream with a blocksize of {@link 
CpioConstants#BLOCK_SIZE BLOCK_SIZE} expecting ASCII file names.
      *
@@ -240,19 +253,6 @@ public CpioArchiveInputStream(final InputStream in, final 
String encoding) {
         this(in, builder().setCharset(encoding));
     }
 
-    private CpioArchiveInputStream(final Builder builder) throws IOException {
-        this(builder.getInputStream(), builder);
-    }
-
-    private CpioArchiveInputStream(final InputStream in, final Builder 
builder) {
-        super(in, builder.getCharset());
-        if (builder.blockSize <= 0) {
-            throw new IllegalArgumentException("blockSize must be bigger than 
0");
-        }
-        this.blockSize = builder.blockSize;
-        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
-    }
-
     /**
      * Returns 0 after EOF has reached for the current entry data, otherwise 
always return 1.
      * <p>
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
index 9d8ec91f1..258c191bc 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveInputStream.java
@@ -73,6 +73,16 @@ public DumpArchiveInputStream get() throws IOException {
     private static final String CURRENT_PATH_SEGMENT = ".";
     private static final String PARENT_PATH_SEGMENT = "..";
 
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
     /**
      * Look at the first few bytes of the file to decide if it's a dump 
archive. With 32 bytes we can look at the magic value, with a full 1k we can 
verify the
      * checksum.
@@ -96,16 +106,6 @@ public static boolean matches(final byte[] buffer, final 
int length) {
         return DumpArchiveConstants.NFS_MAGIC == 
DumpArchiveUtil.convert32(buffer, 24);
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     private final DumpArchiveSummary summary;
     private DumpArchiveEntry active;
     private boolean isClosed;
@@ -137,6 +137,10 @@ public static Builder builder() {
      */
     private final ZipEncoding zipEncoding;
 
+    private DumpArchiveInputStream(final Builder builder) throws IOException {
+        this(builder.getInputStream(), builder);
+    }
+
     /**
      * Constructor using the platform's default encoding for file names.
      *
@@ -147,22 +151,6 @@ public DumpArchiveInputStream(final InputStream is) throws 
ArchiveException {
         this(is, builder());
     }
 
-    /**
-     * Constructs a new instance.
-     *
-     * @param is       stream to read from
-     * @param encoding the encoding to use for file names, use null for the 
platform's default encoding
-     * @throws ArchiveException on error
-     * @since 1.6
-     */
-    public DumpArchiveInputStream(final InputStream is, final String encoding) 
throws ArchiveException {
-        this(is, builder().setCharset(encoding));
-    }
-
-    private DumpArchiveInputStream(final Builder builder) throws IOException {
-        this(builder.getInputStream(), builder);
-    }
-
     private DumpArchiveInputStream(final InputStream is, final Builder 
builder) throws ArchiveException {
         super(is, builder.getCharset());
         this.raw = new TapeInputStream(is);
@@ -208,6 +196,18 @@ private DumpArchiveInputStream(final InputStream is, final 
Builder builder) thro
         });
     }
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param is       stream to read from
+     * @param encoding the encoding to use for file names, use null for the 
platform's default encoding
+     * @throws ArchiveException on error
+     * @since 1.6
+     */
+    public DumpArchiveInputStream(final InputStream is, final String encoding) 
throws ArchiveException {
+        this(is, builder().setCharset(encoding));
+    }
+
     /**
      * Closes the stream for this entry.
      */
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
index c04f2491b..4e4c4a584 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
@@ -52,6 +52,16 @@ public JarArchiveInputStream get() throws IOException {
         }
     }
 
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder jarInputStreamBuilder() {
+        return new Builder();
+    }
+
     /**
      * Checks if the signature matches what is expected for a jar file (in 
this case it is the same as for a ZIP file).
      *
@@ -63,14 +73,8 @@ public static boolean matches(final byte[] signature, final 
int length) {
         return ZipArchiveInputStream.matches(signature, length);
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder jarInputStreamBuilder() {
-        return new Builder();
+    private JarArchiveInputStream(final Builder builder) throws IOException {
+        super(builder);
     }
 
     /**
@@ -93,10 +97,6 @@ public JarArchiveInputStream(final InputStream inputStream, 
final String encodin
         super(inputStream, encoding);
     }
 
-    private JarArchiveInputStream(final Builder builder) throws IOException {
-        super(builder);
-    }
-
     @Override
     public JarArchiveEntry getNextEntry() throws IOException {
         return getNextJarEntry();
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index bf5a5ccd1..9be91c189 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -218,14 +218,6 @@ private TarArchiveInputStream(final Builder builder) 
throws IOException {
         this(builder.getInputStream(), builder);
     }
 
-    private TarArchiveInputStream(final InputStream inputStream, final Builder 
builder) {
-        super(inputStream, builder.getCharset());
-        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
-        this.recordBuffer = new byte[builder.recordSize];
-        this.blockSize = builder.blockSize;
-        this.lenient = builder.lenient;
-    }
-
     /**
      * Constructs a new instance.
      *
@@ -249,6 +241,14 @@ public TarArchiveInputStream(final InputStream 
inputStream, final boolean lenien
         this(inputStream, builder().setLenient(lenient));
     }
 
+    private TarArchiveInputStream(final InputStream inputStream, final Builder 
builder) {
+        super(inputStream, builder.getCharset());
+        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
+        this.recordBuffer = new byte[builder.recordSize];
+        this.blockSize = builder.blockSize;
+        this.lenient = builder.lenient;
+    }
+
     /**
      * Constructs a new instance.
      *
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index a2edcc87b..46f89b6f9 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -98,16 +98,22 @@ protected AbstractBuilder() {
         }
 
         /**
-         * Sets whether to use InfoZIP Unicode Extra Fields (if present) to 
set the file names.
+         * Tests whether the stream should skip the ZIP split signature.
          *
-         * <p>This feature is enabled by default.</p>
+         * @return {@code true} to skip the ZIP split signature, {@code false} 
otherwise.
+         */
+        protected boolean isSkipSplitSignature() {
+            return skipSplitSignature;
+        }
+
+        /**
+         * Tests whether the stream attempts to read STORED entries that use a 
data descriptor.
          *
-         * @param useUnicodeExtraFields If {@code true} Unicode Extra Fields 
should be used.
-         * @return {@code this} instance.
+         * @return {@code true} to read STORED entries with data descriptors,
+         *         {@code false} to stop at the compressed size.
          */
-        public B setUseUnicodeExtraFields(final boolean useUnicodeExtraFields) 
{
-            this.useUnicodeExtraFields = useUnicodeExtraFields;
-            return asThis();
+        protected boolean isSupportStoredEntryDataDescriptor() {
+            return supportStoredEntryDataDescriptor;
         }
 
         /**
@@ -119,6 +125,20 @@ protected boolean isUseUnicodeExtraFields() {
             return useUnicodeExtraFields;
         }
 
+        /**
+         * Sets whether the stream should skip the ZIP split signature
+         * ({@code 08074B50}) at the beginning of the input.
+         *
+         * <p>Disabled by default.</p>
+         *
+         * @param skipSplitSignature {@code true} to skip the ZIP split 
signature, {@code false} otherwise.
+         * @return {@code this} instance.
+         */
+        public B setSkipSplitSignature(final boolean skipSplitSignature) {
+            this.skipSplitSignature = skipSplitSignature;
+            return asThis();
+        }
+
         /**
          * Sets whether the stream supports reading STORED entries that use a 
data descriptor.
          *
@@ -142,63 +162,17 @@ public B setSupportStoredEntryDataDescriptor(final 
boolean supportStoredEntryDat
         }
 
         /**
-         * Tests whether the stream attempts to read STORED entries that use a 
data descriptor.
-         *
-         * @return {@code true} to read STORED entries with data descriptors,
-         *         {@code false} to stop at the compressed size.
-         */
-        protected boolean isSupportStoredEntryDataDescriptor() {
-            return supportStoredEntryDataDescriptor;
-        }
-
-        /**
-         * Sets whether the stream should skip the ZIP split signature
-         * ({@code 08074B50}) at the beginning of the input.
+         * Sets whether to use InfoZIP Unicode Extra Fields (if present) to 
set the file names.
          *
-         * <p>Disabled by default.</p>
+         * <p>This feature is enabled by default.</p>
          *
-         * @param skipSplitSignature {@code true} to skip the ZIP split 
signature, {@code false} otherwise.
+         * @param useUnicodeExtraFields If {@code true} Unicode Extra Fields 
should be used.
          * @return {@code this} instance.
          */
-        public B setSkipSplitSignature(final boolean skipSplitSignature) {
-            this.skipSplitSignature = skipSplitSignature;
+        public B setUseUnicodeExtraFields(final boolean useUnicodeExtraFields) 
{
+            this.useUnicodeExtraFields = useUnicodeExtraFields;
             return asThis();
         }
-
-        /**
-         * Tests whether the stream should skip the ZIP split signature.
-         *
-         * @return {@code true} to skip the ZIP split signature, {@code false} 
otherwise.
-         */
-        protected boolean isSkipSplitSignature() {
-            return skipSplitSignature;
-        }
-    }
-
-    /**
-     * Builds a new {@link ZipArchiveInputStream}.
-     * <p>
-     *     For example:
-     * </p>
-     * <pre>{@code
-     * ZipArchiveInputStream in = ZipArchiveInputStream.builder()
-     *     .setPath(inputPath)
-     *     .setCharset(StandardCharsets.UTF_8)
-     *     .setUseUnicodeExtraFields(false)
-     *     .get();
-     * }</pre>
-     * @since 1.29.0
-     */
-    public static final class Builder extends 
AbstractBuilder<ZipArchiveInputStream, Builder> {
-
-        private Builder() {
-            // empty
-        }
-
-        @Override
-        public ZipArchiveInputStream get() throws IOException {
-            return new ZipArchiveInputStream(this);
-        }
     }
 
     /**
@@ -254,6 +228,32 @@ private int readCount(final int bytesRead) {
         }
     }
 
+    /**
+     * Builds a new {@link ZipArchiveInputStream}.
+     * <p>
+     *     For example:
+     * </p>
+     * <pre>{@code
+     * ZipArchiveInputStream in = ZipArchiveInputStream.builder()
+     *     .setPath(inputPath)
+     *     .setCharset(StandardCharsets.UTF_8)
+     *     .setUseUnicodeExtraFields(false)
+     *     .get();
+     * }</pre>
+     * @since 1.29.0
+     */
+    public static final class Builder extends 
AbstractBuilder<ZipArchiveInputStream, Builder> {
+
+        private Builder() {
+            // empty
+        }
+
+        @Override
+        public ZipArchiveInputStream get() throws IOException {
+            return new ZipArchiveInputStream(this);
+        }
+    }
+
     /**
      * Structure collecting information for the entry that is currently being 
read.
      */
@@ -327,6 +327,16 @@ private <T extends InputStream> T checkInputStream() 
throws ZipException {
     private static final byte[] APK_SIGNING_BLOCK_MAGIC = { 'A', 'P', 'K', ' 
', 'S', 'i', 'g', ' ', 'B', 'l', 'o', 'c', 'k', ' ', '4', '2', };
     private static final BigInteger LONG_MAX = 
BigInteger.valueOf(Long.MAX_VALUE);
 
+    /**
+     * Creates a new builder.
+     *
+     * @return A new builder
+     * @since 1.29.0
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
     /**
      * Checks if the signature matches what is expected for a ZIP file. Does 
not currently handle self-extracting ZIPs which may have arbitrary leading 
content.
      *
@@ -344,16 +354,6 @@ public static boolean matches(final byte[] buffer, final 
int length) {
                 || ArrayUtils.startsWith(buffer, 
ZipLong.SINGLE_SEGMENT_SPLIT_MARKER.getBytes());
     }
 
-    /**
-     * Creates a new builder.
-     *
-     * @return A new builder
-     * @since 1.29.0
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
     /** The ZIP encoding to use for file names and the file comment. */
     private final ZipEncoding zipEncoding;
     /** Whether to look for and use Unicode extra fields. */
@@ -398,6 +398,17 @@ public static Builder builder() {
      */
     // private Function<ZipShort, ZipExtraField> extraFieldSupport;
 
+    /**
+     * Creates an instance from the given builder.
+     *
+     * @param builder The builder used to configure and create the stream.
+     * @throws IOException If the builder fails to create the underlying 
{@link InputStream}.
+     * @since 1.29.0
+     */
+    protected ZipArchiveInputStream(final AbstractBuilder<?, ?> builder) 
throws IOException {
+        this(builder.getInputStream(), builder);
+    }
+
     /**
      * Constructs an instance using UTF-8 encoding.
      *
@@ -407,6 +418,17 @@ public ZipArchiveInputStream(final InputStream 
inputStream) {
         this(inputStream, builder());
     }
 
+    private ZipArchiveInputStream(final InputStream inputStream, final 
AbstractBuilder<?, ?> builder) {
+        super(inputStream, builder.getCharset());
+        this.in = new PushbackInputStream(inputStream, buf.capacity());
+        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
+        this.useUnicodeExtraFields = builder.isUseUnicodeExtraFields();
+        this.supportStoredEntryDataDescriptor = 
builder.isSupportStoredEntryDataDescriptor();
+        this.skipSplitSignature = builder.isSkipSplitSignature();
+        // haven't read anything so far
+        buf.limit(0);
+    }
+
     /**
      * Constructs an instance using the specified encoding.
      *
@@ -478,28 +500,6 @@ public ZipArchiveInputStream(
                         .setSkipSplitSignature(skipSplitSignature));
     }
 
-    /**
-     * Creates an instance from the given builder.
-     *
-     * @param builder The builder used to configure and create the stream.
-     * @throws IOException If the builder fails to create the underlying 
{@link InputStream}.
-     * @since 1.29.0
-     */
-    protected ZipArchiveInputStream(final AbstractBuilder<?, ?> builder) 
throws IOException {
-        this(builder.getInputStream(), builder);
-    }
-
-    private ZipArchiveInputStream(final InputStream inputStream, final 
AbstractBuilder<?, ?> builder) {
-        super(inputStream, builder.getCharset());
-        this.in = new PushbackInputStream(inputStream, buf.capacity());
-        this.zipEncoding = 
ZipEncodingHelper.getZipEncoding(builder.getCharset());
-        this.useUnicodeExtraFields = builder.isUseUnicodeExtraFields();
-        this.supportStoredEntryDataDescriptor = 
builder.isSupportStoredEntryDataDescriptor();
-        this.skipSplitSignature = builder.isSkipSplitSignature();
-        // haven't read anything so far
-        buf.limit(0);
-    }
-
     /**
      * Checks whether the current buffer contains the signature of a 
&quot;data descriptor&quot;, &quot;local file header&quot; or &quot;central 
directory
      * entry&quot;.
diff --git 
a/src/main/java/org/apache/commons/compress/harmony/pack200/IntList.java 
b/src/main/java/org/apache/commons/compress/harmony/pack200/IntList.java
index 73d416c8b..b17df540f 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/IntList.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/IntList.java
@@ -30,9 +30,13 @@
  */
 public class IntList {
 
+    private static int calculateIncrement(final int size, final int required) {
+        return NumberUtils.max(size / 2, required, 12);
+    }
     private int[] array;
     private int firstIndex;
     private int lastIndex;
+
     private int modCount;
 
     /**
@@ -122,10 +126,6 @@ public int get(final int location) {
         throw new IndexOutOfBoundsException("" + location);
     }
 
-    private static int calculateIncrement(final int size, final int required) {
-        return NumberUtils.max(size / 2, required, 12);
-    }
-
     private void growAtEnd(final int required) {
         final int size = lastIndex - firstIndex;
         if (firstIndex >= required - (array.length - lastIndex)) {
diff --git 
a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
 
b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
index 834f3ed63..f22cb4344 100644
--- 
a/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
+++ 
b/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStreamTest.java
@@ -68,6 +68,13 @@
 
 class TarArchiveInputStreamTest extends AbstractTest {
 
+    @SuppressWarnings("resource") // Caller closes
+    private static TarArchiveInputStream getTestStream(final String name) 
throws IOException {
+        return TarArchiveInputStream.builder()
+                .setURI(getURI(name))
+                .get();
+    }
+
     private void datePriorToEpoch(final String archive) throws Exception {
         try (TarArchiveInputStream in = getTestStream(archive)) {
             final TarArchiveEntry tae = in.getNextTarEntry();
@@ -86,13 +93,6 @@ private void getNextEntryUntilIOException(final 
TarArchiveInputStream archive) {
         assertThrows(IOException.class, () -> 
archive.forEach(IOConsumer.noop()));
     }
 
-    @SuppressWarnings("resource") // Caller closes
-    private static TarArchiveInputStream getTestStream(final String name) 
throws IOException {
-        return TarArchiveInputStream.builder()
-                .setURI(getURI(name))
-                .get();
-    }
-
     @Test
     void testChecksumOnly4Byte() throws IOException {
         try (TarArchiveInputStream archive = TarArchiveInputStream.builder()

Reply via email to