Skip to content

Commit f03c2ac

Browse files
committed
Javadoc
Sort members
1 parent 8828e66 commit f03c2ac

7 files changed

Lines changed: 39 additions & 28 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public Builder setCharSequence(final CharSequence source) {
8787

8888
}
8989

90+
private static final int NO_MARK = -1;
91+
9092
/**
9193
* Constructs a new {@link Builder}.
9294
*
@@ -97,8 +99,6 @@ public static Builder builder() {
9799
return new Builder();
98100
}
99101

100-
private static final int NO_MARK = -1;
101-
102102
private final CharsetEncoder charsetEncoder;
103103
private final CharBuffer cBuf;
104104
private final ByteBuffer bBuf;

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
* To build an instance, see {@link Builder}.
4747
* </p>
4848
* <pre>{@code
49-
* BufferedInputStream s = new BufferedInputStream(new GzipInputStream(MemoryMappedFileInputStream.builder()
50-
* .setPath(path)
51-
* .setBufferSize(256 * 1024)
52-
* .get()));}
49+
* BufferedInputStream s = new BufferedInputStream(new GzipInputStream(
50+
* MemoryMappedFileInputStream.builder()
51+
* .setPath(path)
52+
* .setBufferSize(256 * 1024)
53+
* .get()));}
5354
* </pre>
5455
* <p>
5556
* should outperform:
@@ -58,10 +59,11 @@
5859
* new GzipInputStream(new MemoryMappedFileInputStream(path))
5960
* </pre>
6061
* <pre>{@code
61-
* GzipInputStream s = new GzipInputStream(MemoryMappedFileInputStream.builder()
62-
* .setPath(path)
63-
* .setBufferSize(256 * 1024)
64-
* .get());}
62+
* GzipInputStream s = new GzipInputStream(
63+
* MemoryMappedFileInputStream.builder()
64+
* .setPath(path)
65+
* .setBufferSize(256 * 1024)
66+
* .get());}
6567
* </pre>
6668
*
6769
* @since 2.12.0

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@
5555
* InputStream inputStream = ...
5656
* Charset cs = ...
5757
* InputStreamReader reader = new InputStreamReader(inputStream, cs);
58-
* ReaderInputStream in2 = new ReaderInputStream(reader, cs);
58+
* ReaderInputStream in2 = ReaderInputStream.builder()
59+
* .setReader(reader)
60+
* .setCharset(cs)
61+
* .get();
5962
* </pre>
6063
* <p>
6164
* {@link ReaderInputStream} implements the same transformation as {@link java.io.OutputStreamWriter}, except that the control flow is reversed: both classes

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939
* </p>
4040
*
4141
* <pre>
42-
* UnsynchronizedBufferedInputStream buf = new UnsynchronizedBufferedInputStream(new FileInputStream(&quot;file.java&quot;));
42+
* UnsynchronizedBufferedInputStream s = new UnsynchronizedBufferedInputStream.Builder().
43+
* .setInputStream(new FileInputStream(&quot;file.java&quot;))
44+
* .setBufferSize(8192)
45+
* .get();
4346
* </pre>
4447
* <p>
4548
* Provenance: Apache Harmony and modified.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
* OutputStream out = ...
5555
* Charset cs = ...
5656
* OutputStreamWriter writer = new OutputStreamWriter(out, cs);
57-
* WriterOutputStream out2 = new WriterOutputStream(writer, cs);
57+
* WriterOutputStream out2 = WriterOutputStream.builder()
58+
* .setWriter(writer)
59+
* .setCharset(cs)
60+
* .get();
5861
* </pre>
5962
* <p>
6063
* {@link WriterOutputStream} implements the same transformation as {@link java.io.InputStreamReader}, except that the control flow is reversed: both classes

src/test/java/org/apache/commons/io/FileUtilsTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,14 +1182,6 @@ public void testCopyFileToOutputStream() throws Exception {
11821182
assertArrayEquals(expected, destination.toByteArray(), "Check Full copy");
11831183
}
11841184

1185-
@Test
1186-
public void testCreateParentDirectories() throws IOException {
1187-
// If a directory already exists, nothing happens.
1188-
FileUtils.createParentDirectories(FileUtils.current());
1189-
// null is a noop
1190-
FileUtils.createParentDirectories(null);
1191-
}
1192-
11931185
@Test
11941186
public void testCopyToDirectoryWithDirectory() throws IOException {
11951187
final File destDirectory = new File(tempDirFile, "destination");
@@ -1357,6 +1349,14 @@ public void testCountFolders2FileSize4() {
13571349
assertEquals(8, FileUtils.sizeOfDirectory(Paths.get("src/test/resources/org/apache/commons/io/dirs-2-file-size-4").toFile()));
13581350
}
13591351

1352+
@Test
1353+
public void testCreateParentDirectories() throws IOException {
1354+
// If a directory already exists, nothing happens.
1355+
FileUtils.createParentDirectories(FileUtils.current());
1356+
// null is a noop
1357+
FileUtils.createParentDirectories(null);
1358+
}
1359+
13601360
@Test
13611361
public void testDecodeUrl() {
13621362
assertEquals("", FileUtils.decodeUrl(""));

src/test/java/org/apache/commons/io/IOUtilsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ public class IOUtilsTest {
111111
* methods are called. (JT)
112112
*/
113113

114+
@BeforeAll
115+
@AfterAll
116+
public static void beforeAll() {
117+
// Not required, just to exercise the method and make sure there are no adverse side-effect when recycling thread locals.
118+
IO.clear();
119+
}
120+
114121
@TempDir
115122
public File temporaryFolder;
116123

@@ -130,13 +137,6 @@ private void assertEqualContent(final byte[] b0, final byte[] b1) {
130137
assertArrayEquals(b0, b1, "Content not equal according to java.util.Arrays#equals()");
131138
}
132139

133-
@BeforeAll
134-
@AfterAll
135-
public static void beforeAll() {
136-
// Not required, just to exercise the method and make sure there are no adverse side-effect when recycling thread locals.
137-
IO.clear();
138-
}
139-
140140
@BeforeEach
141141
public void setUp() {
142142
try {

0 commit comments

Comments
 (0)