Skip to content

Commit 7387d24

Browse files
author
Gary Gregory
committed
Sort main members
1 parent 013b67a commit 7387d24

8 files changed

Lines changed: 84 additions & 84 deletions

File tree

src/main/java/org/apache/commons/io/file/FilesUncheck.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -468,27 +468,27 @@ public static DirectoryStream<Path> newDirectoryStream(final Path dir) {
468468
}
469469

470470
/**
471-
* Delegates to {@link Files#newDirectoryStream(Path, String)} throwing {@link UncheckedIOException} instead of
472-
* {@link IOException}.
471+
* Delegates to {@link Files#newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)} throwing
472+
* {@link UncheckedIOException} instead of {@link IOException}.
473473
*
474474
* @param dir See delegate.
475-
* @param glob See delegate.
475+
* @param filter See delegate.
476476
* @return See delegate.
477477
*/
478-
public static DirectoryStream<Path> newDirectoryStream(final Path dir, final String glob) {
479-
return Uncheck.apply(Files::newDirectoryStream, dir, glob);
478+
public static DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<? super Path> filter) {
479+
return Uncheck.apply(Files::newDirectoryStream, dir, filter);
480480
}
481481

482482
/**
483-
* Delegates to {@link Files#newDirectoryStream(Path, java.nio.file.DirectoryStream.Filter)} throwing
484-
* {@link UncheckedIOException} instead of {@link IOException}.
483+
* Delegates to {@link Files#newDirectoryStream(Path, String)} throwing {@link UncheckedIOException} instead of
484+
* {@link IOException}.
485485
*
486486
* @param dir See delegate.
487-
* @param filter See delegate.
487+
* @param glob See delegate.
488488
* @return See delegate.
489489
*/
490-
public static DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<? super Path> filter) {
491-
return Uncheck.apply(Files::newDirectoryStream, dir, filter);
490+
public static DirectoryStream<Path> newDirectoryStream(final Path dir, final String glob) {
491+
return Uncheck.apply(Files::newDirectoryStream, dir, glob);
492492
}
493493

494494
/**
@@ -657,28 +657,28 @@ public static long size(final Path path) {
657657
}
658658

659659
/**
660-
* Delegates to {@link Files#walk(Path, int, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
660+
* Delegates to {@link Files#walk(Path, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
661661
* {@link IOException}.
662662
*
663663
* @param start See delegate.
664-
* @param maxDepth See delegate.
665664
* @param options See delegate.
666665
* @return See delegate.
667666
*/
668-
public static Stream<Path> walk(final Path start, final int maxDepth, final FileVisitOption... options) {
669-
return Uncheck.apply(Files::walk, start, maxDepth, options);
667+
public static Stream<Path> walk(final Path start, final FileVisitOption... options) {
668+
return Uncheck.apply(Files::walk, start, options);
670669
}
671670

672671
/**
673-
* Delegates to {@link Files#walk(Path, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
672+
* Delegates to {@link Files#walk(Path, int, FileVisitOption...)} throwing {@link UncheckedIOException} instead of
674673
* {@link IOException}.
675674
*
676675
* @param start See delegate.
676+
* @param maxDepth See delegate.
677677
* @param options See delegate.
678678
* @return See delegate.
679679
*/
680-
public static Stream<Path> walk(final Path start, final FileVisitOption... options) {
681-
return Uncheck.apply(Files::walk, start, options);
680+
public static Stream<Path> walk(final Path start, final int maxDepth, final FileVisitOption... options) {
681+
return Uncheck.apply(Files::walk, start, maxDepth, options);
682682
}
683683

684684
/**

src/main/java/org/apache/commons/io/file/PathUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -836,27 +836,27 @@ public static FileTime getLastModifiedFileTime(final File file) throws IOExcepti
836836
* Gets the file's last modified time or null if the file does not exist.
837837
*
838838
* @param path the file to query.
839+
* @param defaultIfAbsent Returns this file time of the file does not exist, may be null.
839840
* @param options options indicating how symbolic links are handled.
840841
* @return the file's last modified time.
841842
* @throws IOException Thrown if an I/O error occurs.
842843
* @since 2.12.0
843844
*/
844-
public static FileTime getLastModifiedFileTime(final Path path, final LinkOption... options) throws IOException {
845-
return getLastModifiedFileTime(path, null, options);
845+
public static FileTime getLastModifiedFileTime(final Path path, final FileTime defaultIfAbsent, final LinkOption... options) throws IOException {
846+
return Files.exists(path) ? getLastModifiedTime(path, options) : defaultIfAbsent;
846847
}
847848

848849
/**
849850
* Gets the file's last modified time or null if the file does not exist.
850851
*
851852
* @param path the file to query.
852-
* @param defaultIfAbsent Returns this file time of the file does not exist, may be null.
853853
* @param options options indicating how symbolic links are handled.
854854
* @return the file's last modified time.
855855
* @throws IOException Thrown if an I/O error occurs.
856856
* @since 2.12.0
857857
*/
858-
public static FileTime getLastModifiedFileTime(final Path path, final FileTime defaultIfAbsent, final LinkOption... options) throws IOException {
859-
return Files.exists(path) ? getLastModifiedTime(path, options) : defaultIfAbsent;
858+
public static FileTime getLastModifiedFileTime(final Path path, final LinkOption... options) throws IOException {
859+
return getLastModifiedFileTime(path, null, options);
860860
}
861861

862862
/**

src/main/java/org/apache/commons/io/function/IOBiFunction.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ static <T, U, R> IOBiFunction<T, U, R> noop() {
5151
return Constants.IO_BI_FUNCTION;
5252
}
5353

54-
/**
55-
* Applies this function to the given arguments.
56-
*
57-
* @param t the first function argument
58-
* @param u the second function argument
59-
* @return the function result
60-
* @throws IOException if an I/O error occurs.
61-
*/
62-
R apply(T t, U u) throws IOException;
63-
6454
/**
6555
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
6656
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
@@ -75,4 +65,14 @@ default <V> IOBiFunction<T, U, V> andThen(final IOFunction<? super R, ? extends
7565
Objects.requireNonNull(after);
7666
return (final T t, final U u) -> after.apply(apply(t, u));
7767
}
68+
69+
/**
70+
* Applies this function to the given arguments.
71+
*
72+
* @param t the first function argument
73+
* @param u the second function argument
74+
* @return the function result
75+
* @throws IOException if an I/O error occurs.
76+
*/
77+
R apply(T t, U u) throws IOException;
7878
}

src/main/java/org/apache/commons/io/function/IOQuadFunction.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@
4141
@FunctionalInterface
4242
public interface IOQuadFunction<T, U, V, W, R> {
4343

44-
/**
45-
* Applies this function to the given arguments.
46-
*
47-
* @param t the first function argument
48-
* @param u the second function argument
49-
* @param v the third function argument
50-
* @param w the fourth function argument
51-
* @return the function result
52-
* @throws IOException if an I/O error occurs.
53-
*/
54-
R apply(T t, U u, V v, W w) throws IOException;
55-
5644
/**
5745
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
5846
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
@@ -67,4 +55,16 @@ default <X> IOQuadFunction<T, U, V, W, X> andThen(final IOFunction<? super R, ?
6755
Objects.requireNonNull(after);
6856
return (final T t, final U u, final V v, final W w) -> after.apply(apply(t, u, v, w));
6957
}
58+
59+
/**
60+
* Applies this function to the given arguments.
61+
*
62+
* @param t the first function argument
63+
* @param u the second function argument
64+
* @param v the third function argument
65+
* @param w the fourth function argument
66+
* @return the function result
67+
* @throws IOException if an I/O error occurs.
68+
*/
69+
R apply(T t, U u, V v, W w) throws IOException;
7070
}

src/main/java/org/apache/commons/io/function/IOTriFunction.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@
4040
@FunctionalInterface
4141
public interface IOTriFunction<T, U, V, R> {
4242

43-
/**
44-
* Applies this function to the given arguments.
45-
*
46-
* @param t the first function argument
47-
* @param u the second function argument
48-
* @param v the third function argument
49-
* @return the function result
50-
* @throws IOException if an I/O error occurs.
51-
*/
52-
R apply(T t, U u, V v) throws IOException;
53-
5443
/**
5544
* Returns a composed function that first applies this function to its input, and then applies the {@code after}
5645
* function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the
@@ -66,4 +55,15 @@ default <W> IOTriFunction<T, U, V, W> andThen(final IOFunction<? super R, ? exte
6655
return (final T t, final U u, final V v) -> after.apply(apply(t, u, v));
6756
}
6857

58+
/**
59+
* Applies this function to the given arguments.
60+
*
61+
* @param t the first function argument
62+
* @param u the second function argument
63+
* @param v the third function argument
64+
* @return the function result
65+
* @throws IOException if an I/O error occurs.
66+
*/
67+
R apply(T t, U u, V v) throws IOException;
68+
6969
}

src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939
*/
4040
public class MessageDigestCalculatingInputStream extends ObservableInputStream {
4141

42-
/**
43-
* The default message digest algorithm.
44-
* <p>
45-
* The MD5 cryptographic algorithm is weak and should not be used.
46-
* </p>
47-
*/
48-
private static final String DEFAULT_ALGORITHM = "MD5";
49-
5042
/**
5143
* Maintains the message digest.
5244
*/
@@ -72,6 +64,25 @@ public void data(final int input) throws IOException {
7264
}
7365
}
7466

67+
/**
68+
* The default message digest algorithm.
69+
* <p>
70+
* The MD5 cryptographic algorithm is weak and should not be used.
71+
* </p>
72+
*/
73+
private static final String DEFAULT_ALGORITHM = "MD5";
74+
75+
/**
76+
* Gets a MessageDigest object that implements the default digest algorithm.
77+
*
78+
* @return a Message Digest object that implements the default algorithm.
79+
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation.
80+
* @see Provider
81+
*/
82+
static MessageDigest getDefaultMessageDigest() throws NoSuchAlgorithmException {
83+
return MessageDigest.getInstance(DEFAULT_ALGORITHM);
84+
}
85+
7586
private final MessageDigest messageDigest;
7687

7788
/**
@@ -117,17 +128,6 @@ public MessageDigestCalculatingInputStream(final InputStream inputStream, final
117128
this(inputStream, MessageDigest.getInstance(algorithm));
118129
}
119130

120-
/**
121-
* Gets a MessageDigest object that implements the default digest algorithm.
122-
*
123-
* @return a Message Digest object that implements the default algorithm.
124-
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation.
125-
* @see Provider
126-
*/
127-
static MessageDigest getDefaultMessageDigest() throws NoSuchAlgorithmException {
128-
return MessageDigest.getInstance(DEFAULT_ALGORITHM);
129-
}
130-
131131
/**
132132
* Gets the {@link MessageDigest}, which is being used for generating the
133133
* checksum.

src/main/java/org/apache/commons/io/monitor/FileEntry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@ public void setLastModified(final FileTime lastModified) {
269269
setLastModified(new SerializableFileTime(lastModified));
270270
}
271271

272-
void setLastModified(final SerializableFileTime lastModified) {
273-
this.lastModified = lastModified;
274-
}
275-
276272
/**
277273
* Sets the last modified time from the last time it
278274
* was checked.
@@ -283,6 +279,10 @@ public void setLastModified(final long lastModified) {
283279
setLastModified(FileTime.fromMillis(lastModified));
284280
}
285281

282+
void setLastModified(final SerializableFileTime lastModified) {
283+
this.lastModified = lastModified;
284+
}
285+
286286
/**
287287
* Sets the length.
288288
*

src/main/java/org/apache/commons/io/output/XmlStreamWriter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ public XmlStreamWriter(final OutputStream out) {
9797
*
9898
* @param out The output stream
9999
* @param defaultEncoding The default encoding if not encoding could be detected
100+
* @since 2.12.0
100101
*/
101-
public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
102-
this(out, Charsets.toCharset(defaultEncoding, StandardCharsets.UTF_8));
102+
public XmlStreamWriter(final OutputStream out, final Charset defaultEncoding) {
103+
this.out = out;
104+
this.defaultCharset = Objects.requireNonNull(defaultEncoding);
103105
}
104106

105107
/**
@@ -108,11 +110,9 @@ public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
108110
*
109111
* @param out The output stream
110112
* @param defaultEncoding The default encoding if not encoding could be detected
111-
* @since 2.12.0
112113
*/
113-
public XmlStreamWriter(final OutputStream out, final Charset defaultEncoding) {
114-
this.out = out;
115-
this.defaultCharset = Objects.requireNonNull(defaultEncoding);
114+
public XmlStreamWriter(final OutputStream out, final String defaultEncoding) {
115+
this(out, Charsets.toCharset(defaultEncoding, StandardCharsets.UTF_8));
116116
}
117117

118118
/**

0 commit comments

Comments
 (0)