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/12/22 21:22:31 UTC

(commons-io) 02/03: 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

commit 1db65f599c5f09fa06e65080f16d98e005007b08
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Dec 22 16:07:12 2023 -0500

    Sort members
---
 .../apache/commons/io/input/BoundedInputStream.java  | 20 ++++++++++----------
 .../apache/commons/io/input/BrokenInputStream.java   | 20 ++++++++++----------
 .../org/apache/commons/io/input/BrokenReader.java    | 20 ++++++++++----------
 .../apache/commons/io/output/BrokenOutputStream.java | 20 ++++++++++----------
 .../org/apache/commons/io/output/BrokenWriter.java   | 20 ++++++++++----------
 .../java/org/apache/commons/io/FileUtilsTest.java    |  4 ++--
 .../commons/io/file/attribute/FileTimesTest.java     | 20 ++++++++++----------
 7 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
index b5c1d179..e1fcf905 100644
--- a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
@@ -105,16 +105,6 @@ public class BoundedInputStream extends FilterInputStream {
         return count;
     }
 
-    /**
-     * Gets how many bytes remain to read.
-     *
-     * @return bytes how many bytes remain to read.
-     * @since 2.16.0
-     */
-    public long getRemaining() {
-        return getMaxLength() - getCount();
-    }
-
     /**
      * Gets the max count of bytes to read.
      *
@@ -125,6 +115,16 @@ public class BoundedInputStream extends FilterInputStream {
         return maxCount;
     }
 
+    /**
+     * Gets how many bytes remain to read.
+     *
+     * @return bytes how many bytes remain to read.
+     * @since 2.16.0
+     */
+    public long getRemaining() {
+        return getMaxLength() - getCount();
+    }
+
     private boolean isMaxLength() {
         return maxCount >= 0 && count >= maxCount;
     }
diff --git a/src/main/java/org/apache/commons/io/input/BrokenInputStream.java b/src/main/java/org/apache/commons/io/input/BrokenInputStream.java
index 1679430f..4130d3fa 100644
--- a/src/main/java/org/apache/commons/io/input/BrokenInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BrokenInputStream.java
@@ -62,16 +62,6 @@ public class BrokenInputStream extends InputStream {
         this(() -> exception);
     }
 
-    /**
-     * Constructs a new stream that always throws the given exception.
-     *
-     * @param exception the exception to be thrown.
-     * @since 2.16.0
-     */
-    public BrokenInputStream(final Throwable exception) {
-        this(() -> exception);
-    }
-
     /**
      * Constructs a new stream that always throws the supplied exception.
      *
@@ -82,6 +72,16 @@ public class BrokenInputStream extends InputStream {
         this.exceptionSupplier = exceptionSupplier;
     }
 
+    /**
+     * Constructs a new stream that always throws the given exception.
+     *
+     * @param exception the exception to be thrown.
+     * @since 2.16.0
+     */
+    public BrokenInputStream(final Throwable exception) {
+        this(() -> exception);
+    }
+
     /**
      * Throws the configured exception.
      *
diff --git a/src/main/java/org/apache/commons/io/input/BrokenReader.java b/src/main/java/org/apache/commons/io/input/BrokenReader.java
index 96557dd4..1b28408a 100644
--- a/src/main/java/org/apache/commons/io/input/BrokenReader.java
+++ b/src/main/java/org/apache/commons/io/input/BrokenReader.java
@@ -62,16 +62,6 @@ public class BrokenReader extends Reader {
         this(() -> exception);
     }
 
-    /**
-     * Constructs a new reader that always throws the given exception.
-     *
-     * @param exception the exception to be thrown.
-     * @since 2.16.0
-     */
-    public BrokenReader(final Throwable exception) {
-        this(() -> exception);
-    }
-
     /**
      * Constructs a new reader that always throws the supplied exception.
      *
@@ -82,6 +72,16 @@ public class BrokenReader extends Reader {
         this.exceptionSupplier = exceptionSupplier;
     }
 
+    /**
+     * Constructs a new reader that always throws the given exception.
+     *
+     * @param exception the exception to be thrown.
+     * @since 2.16.0
+     */
+    public BrokenReader(final Throwable exception) {
+        this(() -> exception);
+    }
+
     /**
      * Throws the configured exception.
      *
diff --git a/src/main/java/org/apache/commons/io/output/BrokenOutputStream.java b/src/main/java/org/apache/commons/io/output/BrokenOutputStream.java
index eaef8d12..5b1dad04 100644
--- a/src/main/java/org/apache/commons/io/output/BrokenOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/BrokenOutputStream.java
@@ -62,16 +62,6 @@ public class BrokenOutputStream extends OutputStream {
         this(() -> exception);
     }
 
-    /**
-     * Constructs a new stream that always throws the given exception.
-     *
-     * @param exception the exception to be thrown.
-     * @since 2.16.0
-     */
-    public BrokenOutputStream(final Throwable exception) {
-        this(() -> exception);
-    }
-
     /**
      * Constructs a new stream that always throws the supplied exception.
      *
@@ -82,6 +72,16 @@ public class BrokenOutputStream extends OutputStream {
         this.exceptionSupplier = exceptionSupplier;
     }
 
+    /**
+     * Constructs a new stream that always throws the given exception.
+     *
+     * @param exception the exception to be thrown.
+     * @since 2.16.0
+     */
+    public BrokenOutputStream(final Throwable exception) {
+        this(() -> exception);
+    }
+
     /**
      * Throws the configured exception.
      *
diff --git a/src/main/java/org/apache/commons/io/output/BrokenWriter.java b/src/main/java/org/apache/commons/io/output/BrokenWriter.java
index 241e8dd1..800d669e 100644
--- a/src/main/java/org/apache/commons/io/output/BrokenWriter.java
+++ b/src/main/java/org/apache/commons/io/output/BrokenWriter.java
@@ -62,16 +62,6 @@ public class BrokenWriter extends Writer {
         this(() -> exception);
     }
 
-    /**
-     * Constructs a new writer that always throws the given exception.
-     *
-     * @param exception the exception to be thrown.
-     * @since 2.16.0
-     */
-    public BrokenWriter(final Throwable exception) {
-        this(() -> exception);
-    }
-
     /**
      * Constructs a new writer that always throws the supplied exception.
      *
@@ -82,6 +72,16 @@ public class BrokenWriter extends Writer {
         this.exceptionSupplier = exceptionSupplier;
     }
 
+    /**
+     * Constructs a new writer that always throws the given exception.
+     *
+     * @param exception the exception to be thrown.
+     * @since 2.16.0
+     */
+    public BrokenWriter(final Throwable exception) {
+        this(() -> exception);
+    }
+
     /**
      * Throws the configured exception.
      *
diff --git a/src/test/java/org/apache/commons/io/FileUtilsTest.java b/src/test/java/org/apache/commons/io/FileUtilsTest.java
index 67f4c26e..45ef7a41 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsTest.java
@@ -98,8 +98,6 @@ import org.junit.jupiter.params.provider.ValueSource;
 @SuppressWarnings({"deprecation", "ResultOfMethodCallIgnored"}) // unit tests include tests of many deprecated methods
 public class FileUtilsTest extends AbstractTempDirTest {
 
-    private static final Path DIR_SIZE_1 = Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-1");
-
     /**
      * DirectoryWalker implementation that recursively lists all files and directories.
      */
@@ -128,6 +126,8 @@ public class FileUtilsTest extends AbstractTempDirTest {
         }
     }
 
+    private static final Path DIR_SIZE_1 = Paths.get("src/test/resources/org/apache/commons/io/dirs-1-file-size-1");
+
     private static final String UTF_8 = StandardCharsets.UTF_8.name();
 
     /** Test data. */
diff --git a/src/test/java/org/apache/commons/io/file/attribute/FileTimesTest.java b/src/test/java/org/apache/commons/io/file/attribute/FileTimesTest.java
index 8b29bd03..d2ef1638 100644
--- a/src/test/java/org/apache/commons/io/file/attribute/FileTimesTest.java
+++ b/src/test/java/org/apache/commons/io/file/attribute/FileTimesTest.java
@@ -141,20 +141,14 @@ public class FileTimesTest {
         assertEquals(isUnixTime, FileTimes.isUnixTime(FileTime.from(Instant.parse(instant))));
     }
 
-    @ParameterizedTest
-    @MethodSource("isUnixFileTimeProvider")
-    public void testIsUnixTimeLong(final String instant, final boolean isUnixTime) {
-        assertEquals(isUnixTime, FileTimes.isUnixTime(Instant.parse(instant).getEpochSecond()));
+    public void testIsUnixTimeFileTimeNull() {
+        assertTrue(FileTimes.isUnixTime(null));
     }
 
     @ParameterizedTest
     @MethodSource("isUnixFileTimeProvider")
-    public void testToUnixTime(final String instant, final boolean isUnixTime) {
-        assertEquals(isUnixTime, FileTimes.isUnixTime(FileTimes.toUnixTime(FileTime.from(Instant.parse(instant)))));
-    }
-
-    public void testIsUnixTimeFileTimeNull() {
-        assertTrue(FileTimes.isUnixTime(null));
+    public void testIsUnixTimeLong(final String instant, final boolean isUnixTime) {
+        assertEquals(isUnixTime, FileTimes.isUnixTime(Instant.parse(instant).getEpochSecond()));
     }
 
     @Test
@@ -221,4 +215,10 @@ public class FileTimesTest {
         assertEquals(Instant.EPOCH.plusSeconds(seconds), FileTimes.plusSeconds(FileTimes.EPOCH, seconds).toInstant());
         assertEquals(Instant.EPOCH, FileTimes.plusSeconds(FileTimes.EPOCH, 0).toInstant());
     }
+
+    @ParameterizedTest
+    @MethodSource("isUnixFileTimeProvider")
+    public void testToUnixTime(final String instant, final boolean isUnixTime) {
+        assertEquals(isUnixTime, FileTimes.isUnixTime(FileTimes.toUnixTime(FileTime.from(Instant.parse(instant)))));
+    }
 }