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 2021/01/27 15:16:07 UTC

[commons-io] branch master updated: 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-io.git


The following commit(s) were added to refs/heads/master by this push:
     new c8ac178  Sort members.
c8ac178 is described below

commit c8ac17854eed2b3300effe131b69b11f352c58d8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 27 10:16:00 2021 -0500

    Sort members.
---
 src/main/java/org/apache/commons/io/FileUtils.java | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 3b88aa3..d22a434 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -186,6 +186,23 @@ public class FileUtils {
     public static final File[] EMPTY_FILE_ARRAY = new File[0];
 
     /**
+     * Copies the given array and adds StandardCopyOption.COPY_ATTRIBUTES.
+     *
+     * @param copyOptions sorted copy options.
+     * @return a new array.
+     */
+    private static CopyOption[] addCopyAttributes(final CopyOption... copyOptions) {
+        // Make a copy first since we don't want to sort the call site's version.
+        final CopyOption[] actual = Arrays.copyOf(copyOptions, copyOptions.length + 1);
+        Arrays.sort(actual, 0, copyOptions.length);
+        if (Arrays.binarySearch(copyOptions, 0, copyOptions.length, StandardCopyOption.COPY_ATTRIBUTES) >= 0) {
+            return copyOptions;
+        }
+        actual[actual.length - 1] = StandardCopyOption.COPY_ATTRIBUTES;
+        return actual;
+    }
+
+    /**
      * Returns a human-readable version of the file size, where the input represents a specific number of bytes.
      * <p>
      * If the size is over 1GB, the size is returned as the number of whole GB, i.e. the size is rounded down to the
@@ -833,23 +850,6 @@ public class FileUtils {
     }
 
     /**
-     * Copies the given array and adds StandardCopyOption.COPY_ATTRIBUTES.
-     *
-     * @param copyOptions sorted copy options.
-     * @return a new array.
-     */
-    private static CopyOption[] addCopyAttributes(final CopyOption... copyOptions) {
-        // Make a copy first since we don't want to sort the call site's version.
-        final CopyOption[] actual = Arrays.copyOf(copyOptions, copyOptions.length + 1);
-        Arrays.sort(actual, 0, copyOptions.length);
-        if (Arrays.binarySearch(copyOptions, 0, copyOptions.length, StandardCopyOption.COPY_ATTRIBUTES) >= 0) {
-            return copyOptions;
-        }
-        actual[actual.length - 1] = StandardCopyOption.COPY_ATTRIBUTES;
-        return actual;
-    }
-
-    /**
      * Copy bytes from a {@code File} to an {@code OutputStream}.
      * <p>
      * This method buffers the input internally, so there is no need to use a {@code BufferedInputStream}.