Sort main members
MODIFY
src/main/java/org/apache/commons/io/file/FilesUncheck.java
src/main/java/org/apache/commons/io/file/FilesUncheck.java
@@ -468,27 +468,27 @@ public static SeekableByteChannel newByteChannel(final Path path, final Set<? ex
}
/**
- * Delegates to {@link Files#newDirectoryStream(Path, String)} throwing {@link UncheckedIOException} instead of
- * {@link IOException}.
+ * Delegates to {@link Files#newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)} throwing
+ * {@link UncheckedIOException} instead of {@link IOException}.
*
* @param dir See delegate.
- * @param glob See delegate.
+ * @param filter See delegate.
* @return See delegate.
*/
- public static DirectoryStream<Path> newDirectoryStream(final Path dir, final String glob) {
- return Uncheck.apply(Files::newDirectoryStream, dir, glob);
+ public static DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<? super Path> filter) {
+ return Uncheck.apply(Files::newDirectoryStream, dir, filter);
}
/**
- * Delegates to {@link Files#newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)} throwing
- * {@link UncheckedIOException} instead of {@link IOException}.
+ * Delegates to {@link Files#newDirectoryStream(Path, String)} throwing {@link UncheckedIOException} instead of
+ * {@link IOException}.
*
* @param dir See delegate.
- * @param filter See delegate.
+ * @param glob See delegate.
* @return See delegate.
*/
- public static DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<? super Path> filter) {
- return Uncheck.apply(Files::newDirectoryStream, dir, filter);
+ public static DirectoryStream<Path> newDirectoryStream(final Path dir, final String glob) {
+ return Uncheck.apply(Files::newDirectoryStream, dir, glob);
}
/**
@@ -657,28 +657,28 @@ public static long size(final Path path) {
}
/**
- * Delegates to {@link Files#walk(Path, int, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
+ * Delegates to {@link Files#walk(Path, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
* {@link IOException}.
*
* @param start See delegate.
- * @param maxDepth See delegate.
* @param options See delegate.
* @return See delegate.
*/
- public static Stream<Path> walk(final Path start, final int maxDepth, final FileVisitOption... options) {
- return Uncheck.apply(Files::walk, start, maxDepth, options);
+ public static Stream<Path> walk(final Path start, final FileVisitOption... options) {
+ return Uncheck.apply(Files::walk, start, options);
}
/**
- * Delegates to {@link Files#walk(Path, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
+ * Delegates to {@link Files#walk(Path, int, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
* {@link IOException}.
*
* @param start See delegate.
+ * @param maxDepth See delegate.
* @param options See delegate.
* @return See delegate.
*/
- public static Stream<Path> walk(final Path start, final FileVisitOption... options) {
- return Uncheck.apply(Files::walk, start, options);
+ public static Stream<Path> walk(final Path start, final int maxDepth, final FileVisitOption... options) {
+ return Uncheck.apply(Files::walk, start, maxDepth, options);
}
/**

MODIFY
src/main/java/org/apache/commons/io/file/PathUtils.java
src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -836,27 +836,27 @@ public static FileTime getLastModifiedFileTime(final File file) throws IOExcepti
* Gets the file's last modified time or null if the file does not exist.
*
* @param path the file to query.
+ * @param defaultIfAbsent Returns this file time of the file does not exist, may be null.
* @param options options indicating how symbolic links are handled.
* @return the file's last modified time.
* @throws IOException Thrown if an I/O error occurs.
* @since 2.12.0
*/
- public static FileTime getLastModifiedFileTime(final Path path, final LinkOption... options) throws IOException {
- return getLastModifiedFileTime(path, null, options);
+ public static FileTime getLastModifiedFileTime(final Path path, final FileTime defaultIfAbsent, final LinkOption... options) throws IOException {
+ return Files.exists(path) ? getLastModifiedTime(path, options) : defaultIfAbsent;
}
/**
* Gets the file's last modified time or null if the file does not exist.
*
* @param path the file to query.
- * @param defaultIfAbsent Returns this file time of the file does not exist, may be null.
* @param options options indicating how symbolic links are handled.
* @return the file's last modified time.
* @throws IOException Thrown if an I/O error occurs.
* @since 2.12.0
*/
- public static FileTime getLastModifiedFileTime(final Path path, final FileTime defaultIfAbsent, final LinkOption... options) throws IOException {
- return Files.exists(path) ? getLastModifiedTime(path, options) : defaultIfAbsent;
+ public static FileTime getLastModifiedFileTime(final Path path, final LinkOption... options) throws IOException {
+ return getLastModifiedFileTime(path, null, options);
}
/**

MODIFY
src/main/java/org/apache/commons/io/function/IOBiFunction.java
src/main/java/org/apache/commons/io/function/IOBiFunction.java
return Constants.IO_BI_FUNCTION;
}
- /**
- * Applies this function to the given arguments.
- *
- * @param t the first function argument
- * @param u the second function argument
- * @return the function result
- * @throws IOException if an I/O error occurs.
- */
- R apply(T t, U u) throws IOException;
-
/**
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
Objects.requireNonNull(after);
return (final T t, final U u) -> after.apply(apply(t, u));
}
+
+ /**
+ * Applies this function to the given arguments.
+ *
+ * @param t the first function argument
+ * @param u the second function argument
+ * @return the function result
+ * @throws IOException if an I/O error occurs.
+ */
+ R apply(T t, U u) throws IOException;
}

MODIFY
src/main/java/org/apache/commons/io/function/IOQuadFunction.java
src/main/java/org/apache/commons/io/function/IOQuadFunction.java
@FunctionalInterface
public interface IOQuadFunction<T, U, V, W, R> {
- /**
- * Applies this function to the given arguments.
- *
- * @param t the first function argument
- * @param u the second function argument
- * @param v the third function argument
- * @param w the fourth function argument
- * @return the function result
- * @throws IOException if an I/O error occurs.
- */
- R apply(T t, U u, V v, W w) throws IOException;
-
/**
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
Objects.requireNonNull(after);
return (final T t, final U u, final V v, final W w) -> after.apply(apply(t, u, v, w));
}
+
+ /**
+ * Applies this function to the given arguments.
+ *
+ * @param t the first function argument
+ * @param u the second function argument
+ * @param v the third function argument
+ * @param w the fourth function argument
+ * @return the function result
+ * @throws IOException if an I/O error occurs.
+ */
+ R apply(T t, U u, V v, W w) throws IOException;
}

MODIFY
src/main/java/org/apache/commons/io/function/IOTriFunction.java
src/main/java/org/apache/commons/io/function/IOTriFunction.java
@FunctionalInterface
public interface IOTriFunction<T, U, V, R> {
- /**
- * Applies this function to the given arguments.
- *
- * @param t the first function argument
- * @param u the second function argument
- * @param v the third function argument
- * @return the function result
- * @throws IOException if an I/O error occurs.
- */
- R apply(T t, U u, V v) throws IOException;
-
/**
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
return (final T t, final U u, final V v) -> after.apply(apply(t, u, v));
}
+ /**
+ * Applies this function to the given arguments.
+ *
+ * @param t the first function argument
+ * @param u the second function argument
+ * @param v the third function argument
+ * @return the function result
+ * @throws IOException if an I/O error occurs.
+ */
+ R apply(T t, U u, V v) throws IOException;
+
}

MODIFY
src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
*/
public class MessageDigestCalculatingInputStream extends ObservableInputStream {
- /**
- * The default message digest algorithm.
- * <p>
- * The MD5 cryptographic algorithm is weak and should not be used.
- * </p>
- */
- private static final String DEFAULT_ALGORITHM = "MD5";
-
/**
* Maintains the message digest.
*/
@@ -72,6 +64,25 @@ public void data(final int input) throws IOException {
}
}
+ /**
+ * The default message digest algorithm.
+ * <p>
+ * The MD5 cryptographic algorithm is weak and should not be used.
+ * </p>
+ */
+ private static final String DEFAULT_ALGORITHM = "MD5";
+
+ /**
+ * Gets a MessageDigest object that implements the default digest algorithm.
+ *
+ * @return a Message Digest object that implements the default algorithm.
+ * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation.
+ * @see Provider
+ */
+ static MessageDigest getDefaultMessageDigest() throws NoSuchAlgorithmException {
+ return MessageDigest.getInstance(DEFAULT_ALGORITHM);
+ }
+
private final MessageDigest messageDigest;
/**
@@ -117,17 +128,6 @@ public MessageDigestCalculatingInputStream(final InputStream inputStream, final
this(inputStream, MessageDigest.getInstance(algorithm));
}
- /**
- * Gets a MessageDigest object that implements the default digest algorithm.
- *
- * @return a Message Digest object that implements the default algorithm.
- * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation.
- * @see Provider
- */
- static MessageDigest getDefaultMessageDigest() throws NoSuchAlgorithmException {
- return MessageDigest.getInstance(DEFAULT_ALGORITHM);
- }
-
/**
* Gets the {@link MessageDigest}, which is being used for generating the
* checksum.

MODIFY
src/main/java/org/apache/commons/io/monitor/FileEntry.java
src/main/java/org/apache/commons/io/monitor/FileEntry.java
@@ -269,10 +269,6 @@ public void setLastModified(final FileTime lastModified) {
setLastModified(new SerializableFileTime(lastModified));
}
- void setLastModified(final SerializableFileTime lastModified) {
- this.lastModified = lastModified;
- }
-
/**
* Sets the last modified time from the last time it
* was checked.
@@ -283,6 +279,10 @@ public void setLastModified(final long lastModified) {
setLastModified(FileTime.fromMillis(lastModified));
}
+ void setLastModified(final SerializableFileTime lastModified) {
+ this.lastModified = lastModified;
+ }
+
/**
* Sets the length.
*

MODIFY
src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
@@ -97,9 +97,11 @@ public XmlStreamWriter(final OutputStream out) {
*
* @param out The output stream
* @param defaultEncoding The default encoding if not encoding could be detected
+ * @since 2.12.0
*/
- public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
- this(out, Charsets.toCharset(defaultEncoding, StandardCharsets.UTF_8));
+ public XmlStreamWriter(final OutputStream out, final Charset defaultEncoding) {
+ this.out = out;
+ this.defaultCharset = Objects.requireNonNull(defaultEncoding);
}
/**
@@ -108,11 +110,9 @@ public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
*
* @param out The output stream
* @param defaultEncoding The default encoding if not encoding could be detected
- * @since 2.12.0
*/
- public XmlStreamWriter(final OutputStream out, final Charset defaultEncoding) {
- this.out = out;
- this.defaultCharset = Objects.requireNonNull(defaultEncoding);
+ public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
+ this(out, Charsets.toCharset(defaultEncoding, StandardCharsets.UTF_8));
}
/**

Sort main members