Skip to content

Commit c8ac178

Browse files
author
Gary Gregory
committed
Sort members.
1 parent 3725829 commit c8ac178

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ public class FileUtils {
185185
*/
186186
public static final File[] EMPTY_FILE_ARRAY = new File[0];
187187

188+
/**
189+
* Copies the given array and adds StandardCopyOption.COPY_ATTRIBUTES.
190+
*
191+
* @param copyOptions sorted copy options.
192+
* @return a new array.
193+
*/
194+
private static CopyOption[] addCopyAttributes(final CopyOption... copyOptions) {
195+
// Make a copy first since we don't want to sort the call site's version.
196+
final CopyOption[] actual = Arrays.copyOf(copyOptions, copyOptions.length + 1);
197+
Arrays.sort(actual, 0, copyOptions.length);
198+
if (Arrays.binarySearch(copyOptions, 0, copyOptions.length, StandardCopyOption.COPY_ATTRIBUTES) >= 0) {
199+
return copyOptions;
200+
}
201+
actual[actual.length - 1] = StandardCopyOption.COPY_ATTRIBUTES;
202+
return actual;
203+
}
204+
188205
/**
189206
* Returns a human-readable version of the file size, where the input represents a specific number of bytes.
190207
* <p>
@@ -832,23 +849,6 @@ public static void copyFile(final File srcFile, final File destFile, final CopyO
832849
requireEqualSizes(srcFile, destFile, srcFile.length(), destFile.length());
833850
}
834851

835-
/**
836-
* Copies the given array and adds StandardCopyOption.COPY_ATTRIBUTES.
837-
*
838-
* @param copyOptions sorted copy options.
839-
* @return a new array.
840-
*/
841-
private static CopyOption[] addCopyAttributes(final CopyOption... copyOptions) {
842-
// Make a copy first since we don't want to sort the call site's version.
843-
final CopyOption[] actual = Arrays.copyOf(copyOptions, copyOptions.length + 1);
844-
Arrays.sort(actual, 0, copyOptions.length);
845-
if (Arrays.binarySearch(copyOptions, 0, copyOptions.length, StandardCopyOption.COPY_ATTRIBUTES) >= 0) {
846-
return copyOptions;
847-
}
848-
actual[actual.length - 1] = StandardCopyOption.COPY_ATTRIBUTES;
849-
return actual;
850-
}
851-
852852
/**
853853
* Copy bytes from a {@code File} to an {@code OutputStream}.
854854
* <p>

0 commit comments

Comments
 (0)