Skip to content

Commit 8700501

Browse files
authored
Improve ReaderInputStream documentation (#291)
* [IO-715] Mention ReaderInputStream behavior regarding CharsetEncoder.reset() * [IO-713] Remove incorrect documentation about ReaderInputStream.available() * (doc) Describe default CodingErrorAction of ReaderInputStream * (doc) Close <p> tags in ReaderInputStream documentation * Remove redundant ReaderInputStream.available() override again
1 parent 146f0db commit 8700501

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@
7070
* appear is when implementing the {@code javax.activation.DataSource} interface from the Java Activation Framework.
7171
* </p>
7272
* <p>
73-
* Given the fact that the {@link Reader} class doesn't provide any way to predict whether the next read operation will
74-
* block or not, it is not possible to provide a meaningful implementation of the {@link InputStream#available()}
75-
* method. A call to this method will always return 0. Also, this class doesn't support {@link InputStream#mark(int)}.
73+
* The {@link #available()} method of this class always returns 0. The methods {@link #mark(int)} and {@link #reset()}
74+
* are not supported.
7675
* </p>
7776
* <p>
7877
* Instances of {@link ReaderInputStream} are not thread safe.
@@ -132,6 +131,11 @@ public ReaderInputStream(final Reader reader) {
132131
* Constructs a new {@link ReaderInputStream} with a default input buffer size of {@value #DEFAULT_BUFFER_SIZE}
133132
* characters.
134133
*
134+
* <p>
135+
* The encoder created for the specified charset will use {@link CodingErrorAction#REPLACE} for malformed input
136+
* and unmappable characters.
137+
* </p>
138+
*
135139
* @param reader the target {@link Reader}
136140
* @param charset the charset encoding
137141
*/
@@ -142,6 +146,11 @@ public ReaderInputStream(final Reader reader, final Charset charset) {
142146
/**
143147
* Constructs a new {@link ReaderInputStream}.
144148
*
149+
* <p>
150+
* The encoder created for the specified charset will use {@link CodingErrorAction#REPLACE} for malformed input
151+
* and unmappable characters.
152+
* </p>
153+
*
145154
* @param reader the target {@link Reader}.
146155
* @param charset the charset encoding.
147156
* @param bufferSize the size of the input buffer in number of characters.
@@ -159,6 +168,11 @@ public ReaderInputStream(final Reader reader, final Charset charset, final int b
159168
/**
160169
* Constructs a new {@link ReaderInputStream}.
161170
*
171+
* <p>
172+
* This constructor does not call {@link CharsetEncoder#reset() reset} on the provided encoder. The caller
173+
* of this constructor should do this when providing an encoder which had already been in use.
174+
* </p>
175+
*
162176
* @param reader the target {@link Reader}
163177
* @param charsetEncoder the charset encoder
164178
* @since 2.1
@@ -170,6 +184,11 @@ public ReaderInputStream(final Reader reader, final CharsetEncoder charsetEncode
170184
/**
171185
* Constructs a new {@link ReaderInputStream}.
172186
*
187+
* <p>
188+
* This constructor does not call {@link CharsetEncoder#reset() reset} on the provided encoder. The caller
189+
* of this constructor should do this when providing an encoder which had already been in use.
190+
* </p>
191+
*
173192
* @param reader the target {@link Reader}
174193
* @param charsetEncoder the charset encoder, null defauls to the default Charset encoder.
175194
* @param bufferSize the size of the input buffer in number of characters
@@ -188,6 +207,11 @@ public ReaderInputStream(final Reader reader, final CharsetEncoder charsetEncode
188207
* Constructs a new {@link ReaderInputStream} with a default input buffer size of {@value #DEFAULT_BUFFER_SIZE}
189208
* characters.
190209
*
210+
* <p>
211+
* The encoder created for the specified charset will use {@link CodingErrorAction#REPLACE} for malformed input
212+
* and unmappable characters.
213+
* </p>
214+
*
191215
* @param reader the target {@link Reader}
192216
* @param charsetName the name of the charset encoding
193217
*/
@@ -198,6 +222,11 @@ public ReaderInputStream(final Reader reader, final String charsetName) {
198222
/**
199223
* Constructs a new {@link ReaderInputStream}.
200224
*
225+
* <p>
226+
* The encoder created for the specified charset will use {@link CodingErrorAction#REPLACE} for malformed input
227+
* and unmappable characters.
228+
* </p>
229+
*
201230
* @param reader the target {@link Reader}
202231
* @param charsetName the name of the charset encoding, null maps to the default Charset.
203232
* @param bufferSize the size of the input buffer in number of characters

0 commit comments

Comments
 (0)