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 2020/08/29 14:50:52 UTC
[commons-io] branch master updated (bef89cf -> 4bb9dea)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git.
from bef89cf Use @since 2.8.0.
new 07abbbb Sort methods in AB order.
new 688cd98 Use final.
new fab7598 Remove //-- spacers.
new 4bb9dea Better local var names.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/org/apache/commons/io/FileUtils.java | 339 ++++++++++-----------
.../io/input/RandomAccessFileInputStream.java | 12 +-
.../ReversedLinesFileReaderTestParamFile.java | 12 +-
3 files changed, 170 insertions(+), 193 deletions(-)
[commons-io] 01/04: Sort methods in AB order.
Posted by gg...@apache.org.
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 07abbbb2ca7512b4ce4aea4009753354d25c73ae
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 28 18:10:13 2020 -0400
Sort methods in AB order.
---
src/main/java/org/apache/commons/io/FileUtils.java | 321 ++++++++++-----------
1 file changed, 160 insertions(+), 161 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 9585e4b..993ad7d 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -1410,19 +1410,6 @@ public class FileUtils {
}
}
- /**
- * Sets the given {@code targetFile}'s last modified date to the value from {@code sourceFile}.
- *
- * @param sourceFile The source file to query.
- * @param targetFile The target file to set.
- * @throws IOException if an error occurs
- */
- private static void setLastModified(final File sourceFile, final File targetFile) throws IOException {
- if (!targetFile.setLastModified(sourceFile.lastModified())) {
- throw new IOException("Failed setLastModified on " + sourceFile);
- }
- }
-
//-----------------------------------------------------------------------
/**
* Deletes a file. If file is a directory, delete it and all sub-directories.
@@ -1666,85 +1653,38 @@ public class FileUtils {
}
/**
- * Tests if the specified {@code File} is newer than the specified {@code Date}.
- *
- * @param file the {@code File} of which the modification date must be compared
- * @param date the date reference
- * @return true if the {@code File} exists and has been modified
- * after the given {@code Date}.
- * @throws NullPointerException if the file or date is {@code null}
- */
- public static boolean isFileNewer(final File file, final Date date) {
- Objects.requireNonNull(date, "date");
- return isFileNewer(file, date.getTime());
- }
-
- //-----------------------------------------------------------------------
- /**
- * Tests if the specified {@code File} is newer than the reference {@code File}.
- *
- * @param file the {@code File} of which the modification date must be compared
- * @param reference the {@code File} of which the modification date is used
- * @return true if the {@code File} exists and has been modified more
- * recently than the reference {@code File}
- * @throws NullPointerException if the file or reference file is {@code null}
- * @throws IllegalArgumentException if the reference file doesn't exist
- */
- public static boolean isFileNewer(final File file, final File reference) {
- Objects.requireNonNull(reference, "reference");
- if (!reference.exists()) {
- throw new IllegalArgumentException("The reference file '"
- + reference + "' doesn't exist");
- }
- return isFileNewer(file, reference.lastModified());
- }
-
- /**
- * Tests if the specified {@code File} is newer than the specified time reference.
- *
- * @param file the {@code File} of which the modification date must be compared
- * @param timeMillis the time reference measured in milliseconds since the
- * epoch (00:00:00 GMT, January 1, 1970)
- * @return true if the {@code File} exists and has been modified after the given time reference.
- * @throws NullPointerException if the file is {@code null}
- */
- public static boolean isFileNewer(final File file, final long timeMillis) {
- Objects.requireNonNull(file, "file");
- if (!file.exists()) {
- return false;
- }
- return file.lastModified() > timeMillis;
- }
-
- /**
- * Tests if the specified {@code File} is newer than the specified {@code Instant}.
+ * Tests if the specified {@code File} is newer than the specified {@code ChronoLocalDate}
+ * at the current time.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param instant the date reference
- * @return true if the {@code File} exists and has been modified after the given {@code Instant}.
- * @throws NullPointerException if the file or instant is {@code null}
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoLocalDate the date reference
+ * @return true if the {@code File} exists and has been modified after the given
+ * {@code ChronoLocalDate} at the current time.
+ * @throws NullPointerException if the file or local date is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileNewer(final File file, final Instant instant) {
- Objects.requireNonNull(instant, "instant");
- return isFileNewer(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
+ public static boolean isFileNewer(final File file, final ChronoLocalDate chronoLocalDate) {
+ return isFileNewer(file, chronoLocalDate, LocalTime.now());
}
/**
- * Tests if the specified {@code File} is newer than the specified {@code ChronoZonedDateTime}.
+ * Tests if the specified {@code File} is newer than the specified {@code ChronoLocalDate}
+ * at the specified time.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoZonedDateTime the date reference
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoLocalDate the date reference
+ * @param localTime the time reference
* @return true if the {@code File} exists and has been modified after the given
- * {@code ChronoZonedDateTime}.
- * @throws NullPointerException if the file or zoned date time is {@code null}
+ * {@code ChronoLocalDate} at the given time.
+ * @throws NullPointerException if the file, local date or zone ID is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileNewer(final File file, final ChronoZonedDateTime<?> chronoZonedDateTime) {
- Objects.requireNonNull(chronoZonedDateTime, "chronoZonedDateTime");
- return isFileNewer(file, chronoZonedDateTime.toInstant());
+ public static boolean isFileNewer(final File file, final ChronoLocalDate chronoLocalDate, final LocalTime localTime) {
+ Objects.requireNonNull(chronoLocalDate, "chronoLocalDate");
+ Objects.requireNonNull(localTime, "localTime");
+ return isFileNewer(file, chronoLocalDate.atTime(localTime));
}
/**
@@ -1783,117 +1723,119 @@ public class FileUtils {
}
/**
- * Tests if the specified {@code File} is newer than the specified {@code ChronoLocalDate}
- * at the current time.
- *
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoLocalDate the date reference
- * @return true if the {@code File} exists and has been modified after the given
- * {@code ChronoLocalDate} at the current time.
- * @throws NullPointerException if the file or local date is {@code null}
- *
- * @since 2.8.0
- */
- public static boolean isFileNewer(final File file, final ChronoLocalDate chronoLocalDate) {
- return isFileNewer(file, chronoLocalDate, LocalTime.now());
- }
-
- /**
- * Tests if the specified {@code File} is newer than the specified {@code ChronoLocalDate}
- * at the specified time.
+ * Tests if the specified {@code File} is newer than the specified {@code ChronoZonedDateTime}.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoLocalDate the date reference
- * @param localTime the time reference
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoZonedDateTime the date reference
* @return true if the {@code File} exists and has been modified after the given
- * {@code ChronoLocalDate} at the given time.
- * @throws NullPointerException if the file, local date or zone ID is {@code null}
+ * {@code ChronoZonedDateTime}.
+ * @throws NullPointerException if the file or zoned date time is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileNewer(final File file, final ChronoLocalDate chronoLocalDate, final LocalTime localTime) {
- Objects.requireNonNull(chronoLocalDate, "chronoLocalDate");
- Objects.requireNonNull(localTime, "localTime");
- return isFileNewer(file, chronoLocalDate.atTime(localTime));
+ public static boolean isFileNewer(final File file, final ChronoZonedDateTime<?> chronoZonedDateTime) {
+ Objects.requireNonNull(chronoZonedDateTime, "chronoZonedDateTime");
+ return isFileNewer(file, chronoZonedDateTime.toInstant());
}
/**
- * Tests if the specified {@code File} is older than the specified {@code Date}.
+ * Tests if the specified {@code File} is newer than the specified {@code Date}.
*
* @param file the {@code File} of which the modification date must be compared
* @param date the date reference
- * @return true if the {@code File} exists and has been modified before the given {@code Date}.
+ * @return true if the {@code File} exists and has been modified
+ * after the given {@code Date}.
* @throws NullPointerException if the file or date is {@code null}
*/
- public static boolean isFileOlder(final File file, final Date date) {
+ public static boolean isFileNewer(final File file, final Date date) {
Objects.requireNonNull(date, "date");
- return isFileOlder(file, date.getTime());
+ return isFileNewer(file, date.getTime());
}
- //-----------------------------------------------------------------------
/**
- * Tests if the specified {@code File} is older than the reference {@code File}.
+ * Tests if the specified {@code File} is newer than the reference {@code File}.
*
* @param file the {@code File} of which the modification date must be compared
* @param reference the {@code File} of which the modification date is used
- * @return true if the {@code File} exists and has been modified before the reference {@code File}
+ * @return true if the {@code File} exists and has been modified more
+ * recently than the reference {@code File}
* @throws NullPointerException if the file or reference file is {@code null}
* @throws IllegalArgumentException if the reference file doesn't exist
*/
- public static boolean isFileOlder(final File file, final File reference) {
- if (!Objects.requireNonNull(reference, "reference").exists()) {
+ public static boolean isFileNewer(final File file, final File reference) {
+ Objects.requireNonNull(reference, "reference");
+ if (!reference.exists()) {
throw new IllegalArgumentException("The reference file '"
+ reference + "' doesn't exist");
}
- return isFileOlder(file, reference.lastModified());
+ return isFileNewer(file, reference.lastModified());
}
/**
- * Tests if the specified {@code File} is older than the specified time reference.
+ * Tests if the specified {@code File} is newer than the specified {@code Instant}.
+ *
+ * @param file the {@code File} of which the modification date must be compared
+ * @param instant the date reference
+ * @return true if the {@code File} exists and has been modified after the given {@code Instant}.
+ * @throws NullPointerException if the file or instant is {@code null}
+ *
+ * @since 2.8.0
+ */
+ public static boolean isFileNewer(final File file, final Instant instant) {
+ Objects.requireNonNull(instant, "instant");
+ return isFileNewer(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
+ }
+
+ /**
+ * Tests if the specified {@code File} is newer than the specified time reference.
*
* @param file the {@code File} of which the modification date must be compared
* @param timeMillis the time reference measured in milliseconds since the
* epoch (00:00:00 GMT, January 1, 1970)
- * @return true if the {@code File} exists and has been modified before the given time reference.
+ * @return true if the {@code File} exists and has been modified after the given time reference.
* @throws NullPointerException if the file is {@code null}
*/
- public static boolean isFileOlder(final File file, final long timeMillis) {
+ public static boolean isFileNewer(final File file, final long timeMillis) {
Objects.requireNonNull(file, "file");
if (!file.exists()) {
return false;
}
- return file.lastModified() < timeMillis;
+ return file.lastModified() > timeMillis;
}
/**
- * Tests if the specified {@code File} is older than the specified {@code Instant}.
+ * Tests if the specified {@code File} is older than the specified {@code ChronoLocalDate}
+ * at the current time.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param instant the date reference
- * @return true if the {@code File} exists and has been modified before the given {@code Instant}.
- * @throws NullPointerException if the file or instant is {@code null}
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoLocalDate the date reference
+ * @return true if the {@code File} exists and has been modified before the given
+ * {@code ChronoLocalDate} at the current time.
+ * @throws NullPointerException if the file or local date is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileOlder(final File file, final Instant instant) {
- Objects.requireNonNull(instant, "instant");
- return isFileOlder(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
+ public static boolean isFileOlder(final File file, final ChronoLocalDate chronoLocalDate) {
+ return isFileOlder(file, chronoLocalDate, LocalTime.now());
}
/**
- * Tests if the specified {@code File} is older than the specified {@code ChronoZonedDateTime}.
+ * Tests if the specified {@code File} is older than the specified {@code ChronoLocalDate}
+ * at the specified {@code LocalTime}.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoZonedDateTime the date reference
- * @return true if the {@code File} exists and has been modified before the given
- * {@code ChronoZonedDateTime}.
- * @throws NullPointerException if the file or zoned date time is {@code null}
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoLocalDate the date reference
+ * @param localTime the time reference
+ * @return true if the {@code File} exists and has been modified before the
+ * given {@code ChronoLocalDate} at the specified time.
+ * @throws NullPointerException if the file, local date or local time is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileOlder(final File file, final ChronoZonedDateTime<?> chronoZonedDateTime) {
- Objects.requireNonNull(chronoZonedDateTime, "chronoZonedDateTime");
- return isFileOlder(file, chronoZonedDateTime.toInstant());
+ public static boolean isFileOlder(final File file, final ChronoLocalDate chronoLocalDate, final LocalTime localTime) {
+ Objects.requireNonNull(chronoLocalDate, "chronoLocalDate");
+ Objects.requireNonNull(localTime, "localTime");
+ return isFileOlder(file, chronoLocalDate.atTime(localTime));
}
/**
@@ -1932,38 +1874,82 @@ public class FileUtils {
}
/**
- * Tests if the specified {@code File} is older than the specified {@code ChronoLocalDate}
- * at the current time.
+ * Tests if the specified {@code File} is older than the specified {@code ChronoZonedDateTime}.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoLocalDate the date reference
+ * @param file the {@code File} of which the modification date must be compared
+ * @param chronoZonedDateTime the date reference
* @return true if the {@code File} exists and has been modified before the given
- * {@code ChronoLocalDate} at the current time.
- * @throws NullPointerException if the file or local date is {@code null}
+ * {@code ChronoZonedDateTime}.
+ * @throws NullPointerException if the file or zoned date time is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileOlder(final File file, final ChronoLocalDate chronoLocalDate) {
- return isFileOlder(file, chronoLocalDate, LocalTime.now());
+ public static boolean isFileOlder(final File file, final ChronoZonedDateTime<?> chronoZonedDateTime) {
+ Objects.requireNonNull(chronoZonedDateTime, "chronoZonedDateTime");
+ return isFileOlder(file, chronoZonedDateTime.toInstant());
}
/**
- * Tests if the specified {@code File} is older than the specified {@code ChronoLocalDate}
- * at the specified {@code LocalTime}.
+ * Tests if the specified {@code File} is older than the specified {@code Date}.
*
- * @param file the {@code File} of which the modification date must be compared
- * @param chronoLocalDate the date reference
- * @param localTime the time reference
- * @return true if the {@code File} exists and has been modified before the
- * given {@code ChronoLocalDate} at the specified time.
- * @throws NullPointerException if the file, local date or local time is {@code null}
+ * @param file the {@code File} of which the modification date must be compared
+ * @param date the date reference
+ * @return true if the {@code File} exists and has been modified before the given {@code Date}.
+ * @throws NullPointerException if the file or date is {@code null}
+ */
+ public static boolean isFileOlder(final File file, final Date date) {
+ Objects.requireNonNull(date, "date");
+ return isFileOlder(file, date.getTime());
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Tests if the specified {@code File} is older than the reference {@code File}.
+ *
+ * @param file the {@code File} of which the modification date must be compared
+ * @param reference the {@code File} of which the modification date is used
+ * @return true if the {@code File} exists and has been modified before the reference {@code File}
+ * @throws NullPointerException if the file or reference file is {@code null}
+ * @throws IllegalArgumentException if the reference file doesn't exist
+ */
+ public static boolean isFileOlder(final File file, final File reference) {
+ if (!Objects.requireNonNull(reference, "reference").exists()) {
+ throw new IllegalArgumentException("The reference file '"
+ + reference + "' doesn't exist");
+ }
+ return isFileOlder(file, reference.lastModified());
+ }
+
+ /**
+ * Tests if the specified {@code File} is older than the specified {@code Instant}.
+ *
+ * @param file the {@code File} of which the modification date must be compared
+ * @param instant the date reference
+ * @return true if the {@code File} exists and has been modified before the given {@code Instant}.
+ * @throws NullPointerException if the file or instant is {@code null}
*
* @since 2.8.0
*/
- public static boolean isFileOlder(final File file, final ChronoLocalDate chronoLocalDate, final LocalTime localTime) {
- Objects.requireNonNull(chronoLocalDate, "chronoLocalDate");
- Objects.requireNonNull(localTime, "localTime");
- return isFileOlder(file, chronoLocalDate.atTime(localTime));
+ public static boolean isFileOlder(final File file, final Instant instant) {
+ Objects.requireNonNull(instant, "instant");
+ return isFileOlder(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
+ }
+
+ /**
+ * Tests if the specified {@code File} is older than the specified time reference.
+ *
+ * @param file the {@code File} of which the modification date must be compared
+ * @param timeMillis the time reference measured in milliseconds since the
+ * epoch (00:00:00 GMT, January 1, 1970)
+ * @return true if the {@code File} exists and has been modified before the given time reference.
+ * @throws NullPointerException if the file is {@code null}
+ */
+ public static boolean isFileOlder(final File file, final long timeMillis) {
+ Objects.requireNonNull(file, "file");
+ if (!file.exists()) {
+ return false;
+ }
+ return file.lastModified() < timeMillis;
}
/**
@@ -2155,7 +2141,6 @@ public class FileUtils {
return innerListFilesOrDirectories(directory, fileFilter, dirFilter, false);
}
-
/**
* Finds files within a given directory (and optionally its subdirectories)
* which match an array of extensions.
@@ -2179,6 +2164,7 @@ public class FileUtils {
recursive ? TrueFileFilter.INSTANCE : FalseFileFilter.INSTANCE);
}
+
/**
* Finds files within a given directory (and optionally its
* subdirectories). All files found are filtered by an IOFileFilter.
@@ -2364,8 +2350,6 @@ public class FileUtils {
}
//-----------------------------------------------------------------------
-
- //-----------------------------------------------------------------------
/**
* Opens a {@link FileInputStream} for the specified file, providing better
* error messages than simply calling <code>new FileInputStream(file)</code>.
@@ -2401,6 +2385,8 @@ public class FileUtils {
}
//-----------------------------------------------------------------------
+
+ //-----------------------------------------------------------------------
/**
* Opens a {@link FileOutputStream} for the specified file, checking and
* creating the parent directory if it does not exist.
@@ -2581,6 +2567,19 @@ public class FileUtils {
}
/**
+ * Sets the given {@code targetFile}'s last modified date to the value from {@code sourceFile}.
+ *
+ * @param sourceFile The source file to query.
+ * @param targetFile The target file to set.
+ * @throws IOException if an error occurs
+ */
+ private static void setLastModified(final File sourceFile, final File targetFile) throws IOException {
+ if (!targetFile.setLastModified(sourceFile.lastModified())) {
+ throw new IOException("Failed setLastModified on " + sourceFile);
+ }
+ }
+
+ /**
* Returns a filter that accepts directories in addition to the {@link File} objects accepted by the given filter.
*
* @param dirFilter a base filter to add to
[commons-io] 04/04: Better local var names.
Posted by gg...@apache.org.
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 4bb9deaf7fadedfb12aaedc4d08e53f8aa194b4d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 29 10:50:29 2020 -0400
Better local var names.
---
.../io/input/ReversedLinesFileReaderTestParamFile.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
index 57a925d..08932be 100644
--- a/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
+++ b/src/test/java/org/apache/commons/io/input/ReversedLinesFileReaderTestParamFile.java
@@ -65,22 +65,22 @@ public class ReversedLinesFileReaderTestParamFile {
public void testDataIntegrityWithBufferedReader(final String fileName, final String encodingName,
final Integer blockSize, final boolean useNonDefaultFileSystem) throws IOException, URISyntaxException {
- Path file = Paths.get(getClass().getResource("/" + fileName).toURI());
+ Path filePath = Paths.get(getClass().getResource("/" + fileName).toURI());
FileSystem fileSystem = null;
if (useNonDefaultFileSystem) {
fileSystem = Jimfs.newFileSystem(Configuration.unix());
- file = Files.copy(file, fileSystem.getPath("/" + fileName));
+ filePath = Files.copy(filePath, fileSystem.getPath("/" + fileName));
}
- final Charset encoding = Charset.forName(encodingName);
+ final Charset charset = Charset.forName(encodingName);
try (ReversedLinesFileReader reversedLinesFileReader = blockSize == null
- ? new ReversedLinesFileReader(file, encoding)
- : new ReversedLinesFileReader(file, blockSize, encoding)) {
+ ? new ReversedLinesFileReader(filePath, charset)
+ : new ReversedLinesFileReader(filePath, blockSize, charset)) {
final Stack<String> lineStack = new Stack<>();
String line;
- try (BufferedReader bufferedReader = Files.newBufferedReader(file, encoding)) {
+ try (BufferedReader bufferedReader = Files.newBufferedReader(filePath, charset)) {
// read all lines in normal order
while ((line = bufferedReader.readLine()) != null) {
lineStack.push(line);
[commons-io] 03/04: Remove //-- spacers.
Posted by gg...@apache.org.
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 fab7598f53b59ad7e65e9d38a8ae6541b201b554
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 28 21:20:15 2020 -0400
Remove //-- spacers.
---
src/main/java/org/apache/commons/io/FileUtils.java | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 993ad7d..67070e9 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -176,7 +176,6 @@ public class FileUtils {
*/
public static final File[] EMPTY_FILE_ARRAY = new File[0];
- //-----------------------------------------------------------------------
/**
* Returns a human-readable version of the file size, where the input represents a specific number of bytes.
* <p>
@@ -307,7 +306,6 @@ public class FileUtils {
return checksum;
}
- //-----------------------------------------------------------------------
/**
* Computes the checksum of a file using the CRC32 checksum routine.
* The value of the checksum is returned.
@@ -373,7 +371,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Compares the contents of two files to determine if they are equal or not.
* <p>
@@ -430,7 +427,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Compares the contents of two files to determine if they are equal or not.
* <p>
@@ -482,7 +478,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Converts a Collection containing java.io.File instanced into array
* representation. This is to account for the difference between
@@ -738,7 +733,6 @@ public class FileUtils {
doCopyDirectory(srcDir, destDir, filter, preserveFileDate, exclusionList, copyOptions);
}
- //-----------------------------------------------------------------------
/**
* Copies a directory to within another directory preserving the file dates.
* <p>
@@ -910,7 +904,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Copies a file to a directory preserving the file date.
* <p>
@@ -1094,7 +1087,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Copies bytes from the URL <code>source</code> to a file
* <code>destination</code>. The directories up to <code>destination</code>
@@ -1198,7 +1190,6 @@ public class FileUtils {
return decoded;
}
- //-----------------------------------------------------------------------
/**
* Deletes a directory recursively.
*
@@ -1410,7 +1401,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Deletes a file. If file is a directory, delete it and all sub-directories.
* <p>
@@ -1508,7 +1498,6 @@ public class FileUtils {
forceMkdir(parent);
}
- //-----------------------------------------------------------------------
/**
* Construct a file from the set of name elements.
*
@@ -1591,7 +1580,6 @@ public class FileUtils {
return System.getProperty("user.home");
}
- //-----------------------------------------------------------------------
/**
* Finds files within a given directory (and optionally its
* subdirectories). All files found are filtered by an IOFileFilter.
@@ -1902,7 +1890,6 @@ public class FileUtils {
return isFileOlder(file, date.getTime());
}
- //-----------------------------------------------------------------------
/**
* Tests if the specified {@code File} is older than the reference {@code File}.
*
@@ -2349,7 +2336,6 @@ public class FileUtils {
}
}
- //-----------------------------------------------------------------------
/**
* Opens a {@link FileInputStream} for the specified file, providing better
* error messages than simply calling <code>new FileInputStream(file)</code>.
@@ -2384,9 +2370,7 @@ public class FileUtils {
return new FileInputStream(file);
}
- //-----------------------------------------------------------------------
- //-----------------------------------------------------------------------
/**
* Opens a {@link FileOutputStream} for the specified file, checking and
* creating the parent directory if it does not exist.
@@ -2488,7 +2472,6 @@ public class FileUtils {
return readFileToString(file, Charset.defaultCharset());
}
- //-----------------------------------------------------------------------
/**
* Reads the contents of a file into a String.
* The file is always closed.
@@ -2600,7 +2583,6 @@ public class FileUtils {
return FileFilterUtils.and(fileFilter, FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));
}
- //-----------------------------------------------------------------------
/**
* Returns the size of the specified file or directory. If the provided
* {@link File} is a regular file, then the file's length is returned.
@@ -2771,7 +2753,6 @@ public class FileUtils {
return size;
}
- //-----------------------------------------------------------------------
/**
* Convert from a <code>URL</code> to a <code>File</code>.
* <p>
@@ -2835,7 +2816,6 @@ public class FileUtils {
return files;
}
- //-----------------------------------------------------------------------
/**
* Converts an array of file extensions to suffixes for use
* with IOFileFilters.
@@ -2851,7 +2831,6 @@ public class FileUtils {
return suffixes;
}
- //-----------------------------------------------------------------------
/**
* Implements the same behavior as the "touch" utility on Unix. It creates
* a new file with size 0 or, if the file exists already, it is opened and
@@ -2958,7 +2937,6 @@ public class FileUtils {
return files;
}
- //-----------------------------------------------------------------------
/**
* Waits for NFS to propagate a file creation, imposing a timeout.
* <p>
[commons-io] 02/04: Use final.
Posted by gg...@apache.org.
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 688cd9854fe219a7fb96f79e6b5710c347307136
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 28 21:18:16 2020 -0400
Use final.
---
.../apache/commons/io/input/RandomAccessFileInputStream.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java b/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java
index 9976c2d..d4356de 100644
--- a/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java
@@ -37,7 +37,7 @@ public class RandomAccessFileInputStream extends InputStream {
*
* @param file The file to stream.
*/
- public RandomAccessFileInputStream(RandomAccessFile file) {
+ public RandomAccessFileInputStream(final RandomAccessFile file) {
this(file, false);
}
@@ -47,7 +47,7 @@ public class RandomAccessFileInputStream extends InputStream {
* @param file The file to stream.
* @param closeOnClose Whether to close the underlying file when this stream is closed.
*/
- public RandomAccessFileInputStream(RandomAccessFile file, boolean closeOnClose) {
+ public RandomAccessFileInputStream(final RandomAccessFile file, final boolean closeOnClose) {
this.randomAccessFile = Objects.requireNonNull(file, "file");
this.closeOnClose = closeOnClose;
}
@@ -111,12 +111,12 @@ public class RandomAccessFileInputStream extends InputStream {
}
@Override
- public int read(byte[] bytes) throws IOException {
+ public int read(final byte[] bytes) throws IOException {
return randomAccessFile.read(bytes);
}
@Override
- public int read(byte[] bytes, int offset, int length) throws IOException {
+ public int read(final byte[] bytes, final int offset, final int length) throws IOException {
return randomAccessFile.read(bytes, offset, length);
}
@@ -127,12 +127,12 @@ public class RandomAccessFileInputStream extends InputStream {
* @throws IOException See {@link RandomAccessFile#seek(long)}.
* @see RandomAccessFile#seek(long)
*/
- private void seek(long position) throws IOException {
+ private void seek(final long position) throws IOException {
randomAccessFile.seek(position);
}
@Override
- public long skip(long skipCount) throws IOException {
+ public long skip(final long skipCount) throws IOException {
if (skipCount <= 0) {
return 0;
}