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
The following commit(s) were added to refs/heads/master by this push: new f03c2ace Javadoc f03c2ace is described below commit f03c2ace65d15d21b06d2ceea01dc84bf1f6feef Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu May 18 17:45:54 2023 -0400 Javadoc Sort members --- .../commons/io/input/CharSequenceInputStream.java | 4 ++-- .../commons/io/input/MemoryMappedFileInputStream.java | 18 ++++++++++-------- .../org/apache/commons/io/input/ReaderInputStream.java | 5 ++++- .../io/input/UnsynchronizedBufferedInputStream.java | 5 ++++- .../apache/commons/io/output/WriterOutputStream.java | 5 ++++- src/test/java/org/apache/commons/io/FileUtilsTest.java | 16 ++++++++-------- src/test/java/org/apache/commons/io/IOUtilsTest.java | 14 +++++++------- 7 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java b/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java index b70d3cd9..f19ff33a 100644 --- a/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java +++ b/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java @@ -87,6 +87,8 @@ public class CharSequenceInputStream extends InputStream { } + private static final int NO_MARK = -1; + /** * Constructs a new {@link Builder}. * @@ -97,8 +99,6 @@ public class CharSequenceInputStream extends InputStream { return new Builder(); } - private static final int NO_MARK = -1; - private final CharsetEncoder charsetEncoder; private final CharBuffer cBuf; private final ByteBuffer bBuf; diff --git a/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java b/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java index 3622a501..20308a43 100644 --- a/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java +++ b/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java @@ -46,10 +46,11 @@ import org.apache.commons.io.build.AbstractStreamBuilder; * To build an instance, see {@link Builder}. * </p> * <pre>{@code - * BufferedInputStream s = new BufferedInputStream(new GzipInputStream(MemoryMappedFileInputStream.builder() - * .setPath(path) - * .setBufferSize(256 * 1024) - * .get()));} + * BufferedInputStream s = new BufferedInputStream(new GzipInputStream( + * MemoryMappedFileInputStream.builder() + * .setPath(path) + * .setBufferSize(256 * 1024) + * .get()));} * </pre> * <p> * should outperform: @@ -58,10 +59,11 @@ import org.apache.commons.io.build.AbstractStreamBuilder; * new GzipInputStream(new MemoryMappedFileInputStream(path)) * </pre> * <pre>{@code - * GzipInputStream s = new GzipInputStream(MemoryMappedFileInputStream.builder() - * .setPath(path) - * .setBufferSize(256 * 1024) - * .get());} + * GzipInputStream s = new GzipInputStream( + * MemoryMappedFileInputStream.builder() + * .setPath(path) + * .setBufferSize(256 * 1024) + * .get());} * </pre> * * @since 2.12.0 diff --git a/src/main/java/org/apache/commons/io/input/ReaderInputStream.java b/src/main/java/org/apache/commons/io/input/ReaderInputStream.java index 63b7cf37..a78bd6f8 100644 --- a/src/main/java/org/apache/commons/io/input/ReaderInputStream.java +++ b/src/main/java/org/apache/commons/io/input/ReaderInputStream.java @@ -55,7 +55,10 @@ import org.apache.commons.io.charset.CharsetEncoders; * InputStream inputStream = ... * Charset cs = ... * InputStreamReader reader = new InputStreamReader(inputStream, cs); - * ReaderInputStream in2 = new ReaderInputStream(reader, cs); + * ReaderInputStream in2 = ReaderInputStream.builder() + * .setReader(reader) + * .setCharset(cs) + * .get(); * </pre> * <p> * {@link ReaderInputStream} implements the same transformation as {@link java.io.OutputStreamWriter}, except that the control flow is reversed: both classes diff --git a/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java b/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java index e6f3d525..ad544368 100644 --- a/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java +++ b/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java @@ -39,7 +39,10 @@ import org.apache.commons.io.build.AbstractStreamBuilder; * </p> * * <pre> - * UnsynchronizedBufferedInputStream buf = new UnsynchronizedBufferedInputStream(new FileInputStream("file.java")); + * UnsynchronizedBufferedInputStream s = new UnsynchronizedBufferedInputStream.Builder(). + * .setInputStream(new FileInputStream("file.java")) + * .setBufferSize(8192) + * .get(); * </pre> * <p> * Provenance: Apache Harmony and modified. diff --git a/src/main/java/org/apache/commons/io/output/WriterOutputStream.java b/src/main/java/org/apache/commons/io/output/WriterOutputStream.java index ae38a278..ae36c942 100644 --- a/src/main/java/org/apache/commons/io/output/WriterOutputStream.java +++ b/src/main/java/org/apache/commons/io/output/WriterOutputStream.java @@ -54,7 +54,10 @@ import org.apache.commons.io.charset.CharsetDecoders; * OutputStream out = ... * Charset cs = ... * OutputStreamWriter writer = new OutputStreamWriter(out, cs); - * WriterOutputStream out2 = new WriterOutputStream(writer, cs); + * WriterOutputStream out2 = WriterOutputStream.builder() + * .setWriter(writer) + * .setCharset(cs) + * .get(); * </pre> * <p> * {@link WriterOutputStream} implements the same transformation as {@link java.io.InputStreamReader}, except that the control flow is reversed: both classes diff --git a/src/test/java/org/apache/commons/io/FileUtilsTest.java b/src/test/java/org/apache/commons/io/FileUtilsTest.java index 4ea84fa9..b0e870b4 100644 --- a/src/test/java/org/apache/commons/io/FileUtilsTest.java +++ b/src/test/java/org/apache/commons/io/FileUtilsTest.java @@ -1182,14 +1182,6 @@ public class FileUtilsTest extends AbstractTempDirTest { assertArrayEquals(expected, destination.toByteArray(), "Check Full copy"); } - @Test - public void testCreateParentDirectories() throws IOException { - // If a directory already exists, nothing happens. - FileUtils.createParentDirectories(FileUtils.current()); - // null is a noop - FileUtils.createParentDirectories(null); - } - @Test public void testCopyToDirectoryWithDirectory() throws IOException { final File destDirectory = new File(tempDirFile, "destination"); @@ -1357,6 +1349,14 @@ public class FileUtilsTest extends AbstractTempDirTest { assertEquals(8, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-4").toFile())); } + @Test + public void testCreateParentDirectories() throws IOException { + // If a directory already exists, nothing happens. + FileUtils.createParentDirectories(FileUtils.current()); + // null is a noop + FileUtils.createParentDirectories(null); + } + @Test public void testDecodeUrl() { assertEquals("", FileUtils.decodeUrl("")); diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java b/src/test/java/org/apache/commons/io/IOUtilsTest.java index fbeb99ec..909893df 100644 --- a/src/test/java/org/apache/commons/io/IOUtilsTest.java +++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java @@ -111,6 +111,13 @@ public class IOUtilsTest { * methods are called. (JT) */ + @BeforeAll + @AfterAll + public static void beforeAll() { + // Not required, just to exercise the method and make sure there are no adverse side-effect when recycling thread locals. + IO.clear(); + } + @TempDir public File temporaryFolder; @@ -130,13 +137,6 @@ public class IOUtilsTest { assertArrayEquals(b0, b1, "Content not equal according to java.util.Arrays#equals()"); } - @BeforeAll - @AfterAll - public static void beforeAll() { - // Not required, just to exercise the method and make sure there are no adverse side-effect when recycling thread locals. - IO.clear(); - } - @BeforeEach public void setUp() { try {