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-vfs.git
The following commit(s) were added to refs/heads/master by this push:
new 72ff651 Javadoc.
72ff651 is described below
commit 72ff651788eef5f9510ebad8f0661be7d9d10292
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Dec 6 08:59:08 2021 -0500
Javadoc.
Internal refactoring.
---
.../apache/commons/vfs2/util/RandomAccessMode.java | 23 +++++++++++-----------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java
index f550896..f3954d0 100644
---
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java
+++
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/RandomAccessMode.java
@@ -56,7 +56,11 @@ public enum RandomAccessMode {
* @since 2.10.0
*/
public static RandomAccessMode from(final AccessMode... accessModes) {
- final AccessMode[] modes = sort(accessModes);
+ Objects.requireNonNull(accessModes, "accessModes");
+ if (accessModes.length == 0) {
+ throw new IllegalArgumentException("Empty AccessMode[].");
+ }
+ final AccessMode[] modes = ArraySorter.sort(accessModes.clone());
if (Arrays.binarySearch(modes, AccessMode.WRITE) >= 0) {
return READWRITE;
}
@@ -66,16 +70,11 @@ public enum RandomAccessMode {
throw new IllegalArgumentException(Arrays.toString(accessModes));
}
- private static AccessMode[] sort(final AccessMode... accessModes) {
- Objects.requireNonNull(accessModes, "accessModes");
- if (accessModes.length == 0) {
- throw new IllegalArgumentException("Empty AccessMode[].");
- }
- return ArraySorter.sort(accessModes.clone());
- }
-
/**
- * @return The mode String.
+ * Gets this instance as an access mode string suitable for other APIs,
like {@code "r"} for {@link #READ} and
+ * {@code "rw"} for {@link #READWRITE}.
+ *
+ * @return An access mode String, {@code "r"} for {@link #READ} and {@code
"rw"} for {@link #READWRITE}.
* @since 2.0
*/
public String getModeString() {
@@ -93,7 +92,7 @@ public enum RandomAccessMode {
}
/**
- * Tests read.
+ * Tests the read flag.
*
* @return true for read.
*/
@@ -102,7 +101,7 @@ public enum RandomAccessMode {
}
/**
- * Tests write.
+ * Tests the write flag.
*
* @return true for write.
*/