You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/03/13 12:33:32 UTC

[commons-compress] 01/02: Sort members

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 471cbbc7cecac7730ae3db91f8e7bcdc61b94efb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Mar 13 08:28:27 2023 -0400

    Sort members
---
 .../archivers/zip/DefaultBackingStoreSupplier.java |  6 +++---
 .../commons/compress/archivers/zip/ZipFile.java    | 24 +++++++++++-----------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/DefaultBackingStoreSupplier.java b/src/main/java/org/apache/commons/compress/archivers/zip/DefaultBackingStoreSupplier.java
index 67cd6f9e..64abe13a 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/DefaultBackingStoreSupplier.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/DefaultBackingStoreSupplier.java
@@ -46,6 +46,9 @@ public class DefaultBackingStoreSupplier implements ScatterGatherBackingStoreSup
 
     private static final String PREFIX = "parallelscatter";
 
+    private final AtomicInteger storeNum = new AtomicInteger();
+
+    private final Path dir;
     /**
      * Constructs a new instance. If {@code dir} is null, then use the default temporary-file directory.
      *
@@ -55,9 +58,6 @@ public class DefaultBackingStoreSupplier implements ScatterGatherBackingStoreSup
         this.dir = dir;
     }
 
-    private final AtomicInteger storeNum = new AtomicInteger();
-    private final Path dir;
-
     @Override
     public ScatterGatherBackingStore get() throws IOException {
         final String suffix = "n" + storeNum.incrementAndGet();
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 9ce792f2..641afca0 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -344,6 +344,18 @@ public class ZipFile implements Closeable {
         /* compressed size                 */ + ZipConstants.WORD
         /* uncompressed size               */ + (long) ZipConstants.WORD;
 
+    /**
+     * Compares two ZipArchiveEntries based on their offset within the archive.
+     *
+     * <p>Won't return any meaningful results if one of the entries
+     * isn't part of the archive at all.</p>
+     *
+     * @since 1.1
+     */
+    private static final Comparator<ZipArchiveEntry> offsetComparator =
+        Comparator.comparingLong(ZipArchiveEntry::getDiskNumberStart)
+            .thenComparingLong(ZipArchiveEntry::getLocalHeaderOffset);
+
     /**
      * Closes a ZIP file quietly; throwing no IOException, dooes nothing
      * on null input.
@@ -426,18 +438,6 @@ public class ZipFile implements Closeable {
 
     private long firstLocalFileHeaderOffset;
 
-    /**
-     * Compares two ZipArchiveEntries based on their offset within the archive.
-     *
-     * <p>Won't return any meaningful results if one of the entries
-     * isn't part of the archive at all.</p>
-     *
-     * @since 1.1
-     */
-    private static final Comparator<ZipArchiveEntry> offsetComparator =
-        Comparator.comparingLong(ZipArchiveEntry::getDiskNumberStart)
-            .thenComparingLong(ZipArchiveEntry::getLocalHeaderOffset);
-
     /**
      * Opens the given file for reading, assuming "UTF8" for file names.
      *