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 a0e069db9 [IO-868] BoundedInputStream builder() can throw IOException
a0e069db9 is described below
commit a0e069db94dd2c0a407429dbac37c0ef06d215a7
Author: Gary D. Gregory <[email protected]>
AuthorDate: Fri Feb 14 07:26:55 2025 -0500
[IO-868] BoundedInputStream builder() can throw IOException
- Javadoc improvements
- Remove some @SuppressWarnings("resource")
---
src/main/java/org/apache/commons/io/function/IOSupplier.java | 2 ++
.../org/apache/commons/io/input/AutoCloseInputStream.java | 5 +++--
.../java/org/apache/commons/io/input/BOMInputStream.java | 7 ++++---
.../java/org/apache/commons/io/input/BoundedInputStream.java | 12 ++++++++----
.../commons/io/input/BufferedFileChannelInputStream.java | 5 +++--
.../org/apache/commons/io/input/CharSequenceInputStream.java | 5 +++--
.../org/apache/commons/io/input/ChecksumInputStream.java | 5 +++--
.../apache/commons/io/input/MemoryMappedFileInputStream.java | 5 +++--
.../io/input/MessageDigestCalculatingInputStream.java | 5 +++--
.../apache/commons/io/input/MessageDigestInputStream.java | 5 +++--
.../java/org/apache/commons/io/input/QueueInputStream.java | 3 ++-
.../apache/commons/io/input/RandomAccessFileInputStream.java | 6 +++---
.../org/apache/commons/io/input/ReadAheadInputStream.java | 6 +++---
.../java/org/apache/commons/io/input/ReaderInputStream.java | 6 +++---
.../org/apache/commons/io/input/ReversedLinesFileReader.java | 5 +++--
src/main/java/org/apache/commons/io/input/Tailer.java | 3 ++-
.../org/apache/commons/io/input/ThrottledInputStream.java | 5 +++--
.../org/apache/commons/io/input/UncheckedBufferedReader.java | 5 +++--
.../apache/commons/io/input/UncheckedFilterInputStream.java | 5 +++--
.../org/apache/commons/io/input/UncheckedFilterReader.java | 5 +++--
.../commons/io/input/UnsynchronizedBufferedInputStream.java | 6 +++---
.../commons/io/input/UnsynchronizedByteArrayInputStream.java | 5 +++--
.../commons/io/input/UnsynchronizedFilterInputStream.java | 6 +++---
.../java/org/apache/commons/io/input/XmlStreamReader.java | 6 +++---
.../apache/commons/io/monitor/FileAlterationObserver.java | 2 ++
.../org/apache/commons/io/output/ChunkedOutputStream.java | 1 +
.../apache/commons/io/output/DeferredFileOutputStream.java | 1 +
.../org/apache/commons/io/output/FileWriterWithEncoding.java | 4 ++--
.../org/apache/commons/io/output/LockableFileWriter.java | 3 ++-
.../java/org/apache/commons/io/output/ProxyOutputStream.java | 2 +-
.../commons/io/output/RandomAccessFileOutputStream.java | 1 -
.../commons/io/output/UncheckedFilterOutputStream.java | 4 ++--
.../org/apache/commons/io/output/UncheckedFilterWriter.java | 4 ++--
.../io/output/UnsynchronizedByteArrayOutputStream.java | 1 +
.../org/apache/commons/io/output/WriterOutputStream.java | 4 ++--
.../java/org/apache/commons/io/output/XmlStreamWriter.java | 4 ++--
36 files changed, 93 insertions(+), 66 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/function/IOSupplier.java
b/src/main/java/org/apache/commons/io/function/IOSupplier.java
index a021e5fce..bac707dd9 100644
--- a/src/main/java/org/apache/commons/io/function/IOSupplier.java
+++ b/src/main/java/org/apache/commons/io/function/IOSupplier.java
@@ -48,6 +48,7 @@ default Supplier<T> asSupplier() {
*
* @return a result.
* @throws IOException if an I/O error occurs.
+ * @see #getUnchecked()
*/
T get() throws IOException;
@@ -56,6 +57,7 @@ default Supplier<T> asSupplier() {
*
* @return a result.
* @throws UncheckedIOException if an I/O error occurs.
+ * @see #get()
* @since 2.17.0
*/
default T getUnchecked() throws UncheckedIOException {
diff --git
a/src/main/java/org/apache/commons/io/input/AutoCloseInputStream.java
b/src/main/java/org/apache/commons/io/input/AutoCloseInputStream.java
index 02ba14b58..516e704f0 100644
--- a/src/main/java/org/apache/commons/io/input/AutoCloseInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/AutoCloseInputStream.java
@@ -72,10 +72,10 @@ public Builder() {
/**
* Builds a new {@link AutoCloseInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -86,6 +86,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public AutoCloseInputStream get() throws IOException {
diff --git a/src/main/java/org/apache/commons/io/input/BOMInputStream.java
b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
index 6a2893099..2096e5923 100644
--- a/src/main/java/org/apache/commons/io/input/BOMInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -151,13 +151,13 @@ public Builder() {
/**
* Builds a new {@link BOMInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects: InputStream, OpenOption[],
include, and ByteOrderMark[].
+ * This builder uses the following aspects: InputStream, OpenOption[],
include, and ByteOrderMark[].
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -170,6 +170,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public BOMInputStream get() throws IOException {
diff --git a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
index d7bf5131b..c2c34c654 100644
--- a/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/BoundedInputStream.java
@@ -252,13 +252,16 @@ public Builder() {
/**
* Builds a new {@link BoundedInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * If you start from an input stream, an exception can't be thrown,
and you can call {@link #getUnchecked()} instead.
+ * </p>
+ * <p>
+ * This builder uses the following aspects:
* </p>
* <ul>
- * <li>{@link #getInputStream()}</li>
+ * <li>{@link #getInputStream()} (the target aspect)</li>
* <li>{@link #getAfterRead()}</li>
* <li>{@link #getCount()}</li>
* <li>{@link #getMaxCount()}</li>
@@ -269,8 +272,9 @@ public Builder() {
* @return a new instance.
* @throws IllegalStateException if the {@code origin} is
{@code null}.
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
- * @throws IOException if an I/O error occurs.
+ * @throws IOException if an I/O error occurs
converting to an {@link InputStream} using {@link #getInputStream()}.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public BoundedInputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/input/BufferedFileChannelInputStream.java
b/src/main/java/org/apache/commons/io/input/BufferedFileChannelInputStream.java
index afa14c4e7..21cf7897d 100644
---
a/src/main/java/org/apache/commons/io/input/BufferedFileChannelInputStream.java
+++
b/src/main/java/org/apache/commons/io/input/BufferedFileChannelInputStream.java
@@ -85,10 +85,10 @@ public Builder() {
/**
* Builds a new {@link BufferedFileChannelInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -101,6 +101,7 @@ public Builder() {
* @throws IOException If an I/O error occurs
* @see #getPath()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
@Override
public BufferedFileChannelInputStream get() throws IOException {
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 05be82f92..d33ba4474 100644
--- a/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/CharSequenceInputStream.java
@@ -95,10 +95,10 @@ public Builder() {
/**
* Builds a new {@link CharSequenceInputStream}.
* <p>
- * You must set input that supports {@link #getCharSequence()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getCharSequence()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getCharSequence()}</li>
@@ -108,6 +108,7 @@ public Builder() {
*
* @return a new instance.
* @throws IllegalArgumentException if the buffer is not large enough
to hold a complete character.
+ * @see #getUnchecked()
*/
@Override
public CharSequenceInputStream get() {
diff --git a/src/main/java/org/apache/commons/io/input/ChecksumInputStream.java
b/src/main/java/org/apache/commons/io/input/ChecksumInputStream.java
index b8b92fda9..80cbd3bae 100644
--- a/src/main/java/org/apache/commons/io/input/ChecksumInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ChecksumInputStream.java
@@ -128,10 +128,10 @@ public Builder() {
/**
* Builds a new {@link ChecksumInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -145,6 +145,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public ChecksumInputStream get() throws IOException {
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 e986dee17..d1dc7c441 100644
--- a/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/MemoryMappedFileInputStream.java
@@ -102,10 +102,10 @@ public Builder() {
/**
* Builds a new {@link MemoryMappedFileInputStream}.
* <p>
- * You must set input that supports {@link #getPath()}, otherwise,
this method throws an exception.
+ * You must set an aspect that supports {@link #getPath()}, otherwise,
this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getPath()}</li>
@@ -118,6 +118,7 @@ public Builder() {
* @throws IOException if an I/O error occurs.
* @see #getPath()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
@Override
public MemoryMappedFileInputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
index 6b6255701..a47293ed0 100644
---
a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
+++
b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
@@ -86,10 +86,10 @@ public Builder() {
/**
* Builds a new {@link MessageDigestCalculatingInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getPath()}</li>
@@ -102,6 +102,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public MessageDigestCalculatingInputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/input/MessageDigestInputStream.java
b/src/main/java/org/apache/commons/io/input/MessageDigestInputStream.java
index 92089cda7..1d8b20d73 100644
--- a/src/main/java/org/apache/commons/io/input/MessageDigestInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/MessageDigestInputStream.java
@@ -85,10 +85,10 @@ public Builder() {
/**
* Builds new {@link MessageDigestInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getPath()}</li>
@@ -101,6 +101,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public MessageDigestInputStream get() throws IOException {
diff --git a/src/main/java/org/apache/commons/io/input/QueueInputStream.java
b/src/main/java/org/apache/commons/io/input/QueueInputStream.java
index bb175cfae..d0d220554 100644
--- a/src/main/java/org/apache/commons/io/input/QueueInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/QueueInputStream.java
@@ -94,7 +94,7 @@ public Builder() {
/**
* Builds a new {@link QueueInputStream}.
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #setBlockingQueue(BlockingQueue)}</li>
@@ -102,6 +102,7 @@ public Builder() {
* </ul>
*
* @return a new instance.
+ * @see #getUnchecked()
*/
@Override
public QueueInputStream get() {
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 312b56308..8fd2b29e4 100644
--- a/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/RandomAccessFileInputStream.java
@@ -70,11 +70,11 @@ public Builder() {
/**
* Builds a new {@link RandomAccessFileInputStream}.
* <p>
- * You must set input that supports {@link RandomAccessFile} or {@link
File}, otherwise, this method throws an exception. Only set one of
+ * You must set an aspect that supports {@link RandomAccessFile} or
{@link File}, otherwise, this method throws an exception. Only set one of
* RandomAccessFile or an origin that can be converted to a File.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link RandomAccessFile}</li>
@@ -87,8 +87,8 @@ public Builder() {
* @throws IllegalStateException if both RandomAccessFile and
origin are set.
* @throws UnsupportedOperationException if the origin cannot be
converted to a {@link File}.
* @see AbstractOrigin#getFile()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource") // Caller closes depending on settings
@Override
public RandomAccessFileInputStream get() throws IOException {
return new RandomAccessFileInputStream(getRandomAccessFile(),
propagateClose);
diff --git
a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
index c03725140..cb08547fa 100644
--- a/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ReadAheadInputStream.java
@@ -81,10 +81,10 @@ public Builder() {
/**
* Builds a new {@link ReadAheadInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -98,8 +98,8 @@ public Builder() {
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public ReadAheadInputStream get() throws IOException {
return new ReadAheadInputStream(getInputStream(), getBufferSize(),
executorService != null ? executorService : newExecutorService(),
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 9fb5185f2..e12659a9a 100644
--- a/src/main/java/org/apache/commons/io/input/ReaderInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ReaderInputStream.java
@@ -120,10 +120,10 @@ public Builder() {
* Builds a new {@link ReaderInputStream}.
*
* <p>
- * You must set input that supports {@link #getReader()}, otherwise,
this method throws an exception.
+ * You must set an aspect that supports {@link #getReader()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getReader()}</li>
@@ -138,8 +138,8 @@ public Builder() {
* @see #getReader()
* @see CharsetEncoder
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public ReaderInputStream get() throws IOException {
return new ReaderInputStream(getReader(), charsetEncoder,
getBufferSize());
diff --git
a/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
b/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
index 9b8d8a99d..d12aadf13 100644
--- a/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
+++ b/src/main/java/org/apache/commons/io/input/ReversedLinesFileReader.java
@@ -98,10 +98,10 @@ public Builder() {
/**
* Builds a new {@link ReversedLinesFileReader}.
* <p>
- * You must set input that supports {@link #getInputStream()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()} on
this builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -116,6 +116,7 @@ public Builder() {
* @see #getPath()
* @see #getBufferSize()
* @see #getCharset()
+ * @see #getUnchecked()
*/
@Override
public ReversedLinesFileReader get() throws IOException {
diff --git a/src/main/java/org/apache/commons/io/input/Tailer.java
b/src/main/java/org/apache/commons/io/input/Tailer.java
index 61ef0fdd0..8514f823b 100644
--- a/src/main/java/org/apache/commons/io/input/Tailer.java
+++ b/src/main/java/org/apache/commons/io/input/Tailer.java
@@ -199,7 +199,7 @@ public Builder() {
* Builds a new {@link Tailer}.
*
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getBufferSize()}</li>
@@ -212,6 +212,7 @@ public Builder() {
* </ul>
*
* @return a new instance.
+ * @see #getUnchecked()
*/
@Override
public Tailer get() {
diff --git
a/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
b/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
index 52fe9e9e1..d5dcb0888 100644
--- a/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
@@ -89,10 +89,10 @@ public Builder() {
/**
* Builds a new {@link ThrottledInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -104,6 +104,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public ThrottledInputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/input/UncheckedBufferedReader.java
b/src/main/java/org/apache/commons/io/input/UncheckedBufferedReader.java
index 53f456512..78e839c02 100644
--- a/src/main/java/org/apache/commons/io/input/UncheckedBufferedReader.java
+++ b/src/main/java/org/apache/commons/io/input/UncheckedBufferedReader.java
@@ -81,10 +81,10 @@ public Builder() {
* Builds a new {@link UncheckedBufferedReader}.
*
* <p>
- * You must set input that supports {@link #getReader()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getReader()} on this
builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getReader()}</li>
@@ -96,6 +96,7 @@ public Builder() {
* @throws IllegalStateException if the {@code origin} is {@code null}.
* @see #getReader()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
@Override
public UncheckedBufferedReader get() {
diff --git
a/src/main/java/org/apache/commons/io/input/UncheckedFilterInputStream.java
b/src/main/java/org/apache/commons/io/input/UncheckedFilterInputStream.java
index 8058caf13..0739f4cc9 100644
--- a/src/main/java/org/apache/commons/io/input/UncheckedFilterInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/UncheckedFilterInputStream.java
@@ -76,10 +76,10 @@ public Builder() {
/**
* Builds a new {@link UncheckedFilterInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()} on
this builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -88,6 +88,7 @@ public Builder() {
* @return a new instance.
* @throws UnsupportedOperationException if the origin cannot provide
an InputStream.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
@Override
public UncheckedFilterInputStream get() {
diff --git
a/src/main/java/org/apache/commons/io/input/UncheckedFilterReader.java
b/src/main/java/org/apache/commons/io/input/UncheckedFilterReader.java
index 975e908ff..1835b6eac 100644
--- a/src/main/java/org/apache/commons/io/input/UncheckedFilterReader.java
+++ b/src/main/java/org/apache/commons/io/input/UncheckedFilterReader.java
@@ -76,10 +76,10 @@ public Builder() {
/**
* Builds a new {@link UncheckedFilterReader}.
* <p>
- * You must set input that supports {@link #getReader()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getReader()} on this
builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getReader()}</li>
@@ -89,6 +89,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot provide
a Reader.
* @throws IllegalStateException if the {@code origin} is {@code null}.
* @see #getReader()
+ * @see #getUnchecked()
*/
@Override
public UncheckedFilterReader get() {
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 234690171..74e464c8c 100644
---
a/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java
+++
b/src/main/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStream.java
@@ -93,10 +93,10 @@ public Builder() {
/**
* Builds a new {@link UnsynchronizedBufferedInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()} on
this builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -109,8 +109,8 @@ public Builder() {
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource") // Caller closes.
@Override
public UnsynchronizedBufferedInputStream get() throws IOException {
return new UnsynchronizedBufferedInputStream(getInputStream(),
getBufferSize());
diff --git
a/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
b/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
index f4f691190..d7229ddd8 100644
---
a/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
+++
b/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
@@ -94,10 +94,10 @@ public Builder() {
/**
* Builds a new {@link UnsynchronizedByteArrayInputStream}.
* <p>
- * You must set input that supports {@code byte[]} on this builder,
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@code byte[]} on this
builder, otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@code byte[]}</li>
@@ -109,6 +109,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot provide
a byte[].
* @throws IllegalStateException if the {@code origin} is
{@code null}.
* @see AbstractOrigin#getByteArray()
+ * @see #getUnchecked()
*/
@Override
public UnsynchronizedByteArrayInputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/input/UnsynchronizedFilterInputStream.java
b/src/main/java/org/apache/commons/io/input/UnsynchronizedFilterInputStream.java
index bfe489bb6..bf2156e29 100644
---
a/src/main/java/org/apache/commons/io/input/UnsynchronizedFilterInputStream.java
+++
b/src/main/java/org/apache/commons/io/input/UnsynchronizedFilterInputStream.java
@@ -80,10 +80,10 @@ public Builder() {
/**
* Builds a new {@link UnsynchronizedFilterInputStream}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -94,8 +94,8 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link InputStream}.
* @throws IOException if an I/O error occurs.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource") // Caller closes.
@Override
public UnsynchronizedFilterInputStream get() throws IOException {
return new UnsynchronizedFilterInputStream(getInputStream());
diff --git a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
index 8640abfa9..04c46982b 100644
--- a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
+++ b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
@@ -133,10 +133,10 @@ public Builder() {
/**
* Builds a new {@link XmlStreamWriter}.
* <p>
- * You must set input that supports {@link #getInputStream()},
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getInputStream()},
otherwise, this method throws an exception.
* </p>
* <p>
- * This builder use the following aspects:
+ * This builder uses the following aspects:
* </p>
* <ul>
* <li>{@link #getInputStream()}</li>
@@ -151,8 +151,8 @@ public Builder() {
* @throws IOException if an I/O error occurs.
* @throws XmlStreamReaderException thrown if the Charset encoding
could not be determined according to the specification.
* @see #getInputStream()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public XmlStreamReader get() throws IOException {
final String defaultEncoding = nullCharset ? null :
getCharset().name();
diff --git
a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
index c784cdf50..330fe3417 100644
--- a/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
+++ b/src/main/java/org/apache/commons/io/monitor/FileAlterationObserver.java
@@ -143,6 +143,8 @@ private Builder() {
/**
* Gets a new {@link FileAlterationObserver} instance.
+ *
+ * @see #getUnchecked()
*/
@Override
public FileAlterationObserver get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java
b/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java
index 74a7b7c20..351200016 100644
--- a/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ChunkedOutputStream.java
@@ -87,6 +87,7 @@ public Builder() {
* @throws IOException if an I/O error occurs.
* @see #getOutputStream()
* @see #getBufferSize()
+ * @see #getUnchecked()
*/
@Override
public ChunkedOutputStream get() throws IOException {
diff --git
a/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java
b/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java
index 38ff820a9..de3f0afb4 100644
--- a/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/DeferredFileOutputStream.java
@@ -106,6 +106,7 @@ public Builder() {
* </ul>
*
* @return a new instance.
+ * @see #getUnchecked()
*/
@Override
public DeferredFileOutputStream get() {
diff --git
a/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
b/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
index 262b08607..528e0c737 100644
--- a/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
+++ b/src/main/java/org/apache/commons/io/output/FileWriterWithEncoding.java
@@ -97,7 +97,7 @@ public Builder() {
/**
* Builds a new {@link FileWriterWithEncoding}.
* <p>
- * You must set input that supports {@link File} on this builder,
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link File} on this builder,
otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -112,8 +112,8 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot provide
a File.
* @throws IllegalStateException if the {@code origin} is {@code null}.
* @see AbstractOrigin#getFile()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public FileWriterWithEncoding get() throws IOException {
if (charsetEncoder != null && getCharset() != null &&
!charsetEncoder.charset().equals(getCharset())) {
diff --git a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
index bafb7524f..f91cd1c28 100644
--- a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
+++ b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java
@@ -87,7 +87,7 @@ public Builder() {
/**
* Constructs a new instance.
* <p>
- * You must set input that supports {@link File} on this builder,
otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link File} on this builder,
otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -103,6 +103,7 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot provide
a File.
* @throws IllegalStateException if the {@code origin} is {@code null}.
* @see AbstractOrigin#getFile()
+ * @see #getUnchecked()
*/
@Override
public LockableFileWriter get() throws IOException {
diff --git a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
index 0cd90a89c..3606607d5 100644
--- a/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ProxyOutputStream.java
@@ -66,8 +66,8 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link OutputStream}.
* @throws IOException if an I/O error occurs.
* @see #getOutputStream()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource") // Caller closes.
@Override
public ProxyOutputStream get() throws IOException {
return new ProxyOutputStream(getOutputStream());
diff --git
a/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
b/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
index 89a959c62..5274e7c76 100644
---
a/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
+++
b/src/main/java/org/apache/commons/io/output/RandomAccessFileOutputStream.java
@@ -60,7 +60,6 @@ private Builder() {
setOpenOptions(StandardOpenOption.WRITE);
}
- @SuppressWarnings("resource")
@Override
public RandomAccessFileOutputStream get() throws IOException {
return new RandomAccessFileOutputStream(getRandomAccessFile());
diff --git
a/src/main/java/org/apache/commons/io/output/UncheckedFilterOutputStream.java
b/src/main/java/org/apache/commons/io/output/UncheckedFilterOutputStream.java
index 34bb3515b..2c1bdb44c 100644
---
a/src/main/java/org/apache/commons/io/output/UncheckedFilterOutputStream.java
+++
b/src/main/java/org/apache/commons/io/output/UncheckedFilterOutputStream.java
@@ -74,7 +74,7 @@ public Builder() {
/**
* Builds a new {@link UncheckedFilterOutputStream}.
* <p>
- * You must set input that supports {@link #getOutputStream()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getOutputStream()} on
this builder, otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -88,8 +88,8 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link OutputStream}.
* @throws IOException if an I/O error occurs.
* @see #getOutputStream()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public UncheckedFilterOutputStream get() throws IOException {
return new UncheckedFilterOutputStream(getOutputStream());
diff --git
a/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
b/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
index 531044f5b..8104036b6 100644
--- a/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
+++ b/src/main/java/org/apache/commons/io/output/UncheckedFilterWriter.java
@@ -75,7 +75,7 @@ public Builder() {
/**
* Builds a new {@link UncheckedFilterWriter}.
* <p>
- * You must set input that supports {@link #getWriter()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getWriter()} on this
builder, otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -87,8 +87,8 @@ public Builder() {
* @return a new instance.
* @throws UnsupportedOperationException if the origin cannot provide
a Writer.
* @see #getWriter()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public UncheckedFilterWriter get() throws IOException {
return new UncheckedFilterWriter(getWriter());
diff --git
a/src/main/java/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.java
b/src/main/java/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.java
index cc0b455c0..88f808eb8 100644
---
a/src/main/java/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.java
+++
b/src/main/java/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.java
@@ -83,6 +83,7 @@ public Builder() {
*
* @return a new instance.
* @see AbstractOrigin#getByteArray()
+ * @see #getUnchecked()
*/
@Override
public UnsynchronizedByteArrayOutputStream get() {
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 39fdb2f8f..0254a02bf 100644
--- a/src/main/java/org/apache/commons/io/output/WriterOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/WriterOutputStream.java
@@ -117,7 +117,7 @@ public Builder() {
/**
* Builds a new {@link WriterOutputStream}.
* <p>
- * You must set input that supports {@link #getWriter()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getWriter()} on this
builder, otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -132,8 +132,8 @@ public Builder() {
* @return a new instance.
* @throws UnsupportedOperationException if the origin cannot provide
a Writer.
* @see #getWriter()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public WriterOutputStream get() throws IOException {
return new WriterOutputStream(getWriter(), charsetDecoder,
getBufferSize(), writeImmediately);
diff --git a/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
b/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
index 060b6234a..196516900 100644
--- a/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
+++ b/src/main/java/org/apache/commons/io/output/XmlStreamWriter.java
@@ -78,7 +78,7 @@ public Builder() {
/**
* Builds a new {@link XmlStreamWriter}.
* <p>
- * You must set input that supports {@link #getOutputStream()} on this
builder, otherwise, this method throws an exception.
+ * You must set an aspect that supports {@link #getOutputStream()} on
this builder, otherwise, this method throws an exception.
* </p>
* <p>
* This builder use the following aspects:
@@ -93,8 +93,8 @@ public Builder() {
* @throws UnsupportedOperationException if the origin cannot be
converted to an {@link OutputStream}.
* @throws IOException if an I/O error occurs.
* @see #getOutputStream()
+ * @see #getUnchecked()
*/
- @SuppressWarnings("resource")
@Override
public XmlStreamWriter get() throws IOException {
return new XmlStreamWriter(getOutputStream(), getCharset());