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 bbc4823 Javadoc fixes. bbc4823 is described below commit bbc482331ca99a517108b71c38b67f8c52a2cf16 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sun Sep 26 10:36:29 2021 -0400 Javadoc fixes. - Minor formatting. - Normalize exception message. --- .../org/apache/commons/io/input/ReaderInputStream.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 45e2934..061a507 100644 --- a/src/main/java/org/apache/commons/io/input/ReaderInputStream.java +++ b/src/main/java/org/apache/commons/io/input/ReaderInputStream.java @@ -43,21 +43,24 @@ import java.util.Objects; * between the current position of the {@link Reader} and that of the {@link ReaderInputStream}. * This also implies that in general there is no need to wrap the underlying {@link Reader} * in a {@link java.io.BufferedReader}. + * </p> * <p> * {@link ReaderInputStream} implements the inverse transformation of {@link java.io.InputStreamReader}; * in the following example, reading from {@code in2} would return the same byte * sequence as reading from {@code in} (provided that the initial byte sequence is legal * with respect to the charset encoding): + * </p> * <pre> * InputStream inputStream = ... * Charset cs = ... * InputStreamReader reader = new InputStreamReader(inputStream, cs); * ReaderInputStream in2 = new ReaderInputStream(reader, cs);</pre> - * + * <p> * {@link ReaderInputStream} implements the same transformation as {@link java.io.OutputStreamWriter}, * except that the control flow is reversed: both classes transform a character stream * into a byte stream, but {@link java.io.OutputStreamWriter} pushes data to the underlying stream, * while {@link ReaderInputStream} pulls it from the underlying stream. + * </p> * <p> * Note that while there are use cases where there is no alternative to using * this class, very often the need to use this class is an indication of a flaw @@ -66,6 +69,7 @@ import java.util.Objects; * is as a character stream, i.e. by providing a {@link Reader} instance. An example of a situation * where this problem may appear is when implementing the {@code javax.activation.DataSource} * interface from the Java Activation Framework. + * </p> * <p> * Given the fact that the {@link Reader} class doesn't provide any way to predict whether the next * read operation will block or not, it is not possible to provide a meaningful @@ -77,7 +81,6 @@ import java.util.Objects; * </p> * * @see org.apache.commons.io.output.WriterOutputStream - * * @since 2.0 */ public class ReaderInputStream extends InputStream { @@ -138,11 +141,13 @@ public class ReaderInputStream extends InputStream { * @param bufferSize the size of the input buffer in number of characters */ public ReaderInputStream(final Reader reader, final Charset charset, final int bufferSize) { + // @formatter:off this(reader, charset.newEncoder() .onMalformedInput(CodingErrorAction.REPLACE) .onUnmappableCharacter(CodingErrorAction.REPLACE), bufferSize); + // @formatter:on } /** @@ -207,7 +212,7 @@ public class ReaderInputStream extends InputStream { if (c == EOF) { endOfInput = true; } else { - encoderIn.position(position+c); + encoderIn.position(position + c); } encoderIn.flip(); } @@ -230,8 +235,7 @@ public class ReaderInputStream extends InputStream { public int read(final byte[] array, int off, int len) throws IOException { Objects.requireNonNull(array, "array"); if (len < 0 || off < 0 || (off + len) > array.length) { - throw new IndexOutOfBoundsException("Array Size=" + array.length + - ", offset=" + off + ", length=" + len); + throw new IndexOutOfBoundsException("Array size=" + array.length + ", offset=" + off + ", length=" + len); } int read = 0; if (len == 0) {