diff --git a/src/main/java/org/apache/commons/io/input/ProxyInputStream.java b/src/main/java/org/apache/commons/io/input/ProxyInputStream.java index cb0cef697df..fd43678e8b7 100644 --- a/src/main/java/org/apache/commons/io/input/ProxyInputStream.java +++ b/src/main/java/org/apache/commons/io/input/ProxyInputStream.java @@ -23,6 +23,7 @@ import java.io.InputStream; import org.apache.commons.io.IOUtils; +import org.apache.commons.io.function.Erase; import org.apache.commons.io.function.IOConsumer; /** @@ -59,10 +60,8 @@ public abstract class ProxyInputStream extends FilterInputStream { * @param proxy the InputStream to proxy. */ public ProxyInputStream(final InputStream proxy) { - // the proxy is stored in a protected superclass variable named 'in' - this(proxy, e -> { - throw e; - }); + // the proxy is stored in a protected superclass variable named 'in'. + this(proxy, Erase::rethrow); } /** @@ -79,7 +78,7 @@ public ProxyInputStream(final InputStream proxy) { /** * Invoked by the {@code read} methods after the proxied call has returned - * successfully. The number of bytes returned to the caller (or -1 if + * successfully. The number of bytes returned to the caller (or {@link IOUtils#EOF EOF} if * the end of stream was reached) is given as an argument. *

* Subclasses can override this method to add common post-processing @@ -93,7 +92,7 @@ public ProxyInputStream(final InputStream proxy) { *

* * @since 2.0 - * @param n number of bytes read, or -1 if the end of stream was reached. + * @param n number of bytes read, or {@link IOUtils#EOF EOF} if the end of stream was reached. * @throws IOException if the post-processing fails in a subclass. */ @SuppressWarnings("unused") // Possibly thrown from subclasses. @@ -162,7 +161,7 @@ public void close() throws IOException { * handling. The default behavior is to re-throw the exception. *

* - * @param e The IOException thrown + * @param e The IOException thrown. * @throws IOException if an I/O error occurs. * @since 2.0 */ @@ -182,7 +181,7 @@ boolean isClosed() { /** * Invokes the delegate's {@link InputStream#mark(int)} method. * - * @param readLimit read ahead limit + * @param readLimit read ahead limit. */ @Override public synchronized void mark(final int readLimit) { @@ -206,7 +205,7 @@ public boolean markSupported() { /** * Invokes the delegate's {@link InputStream#read()} method unless the stream is closed. * - * @return the byte read or {@link IOUtils#EOF EOF} if the end of stream + * @return the byte read or {@link IOUtils#EOF EOF} if we reached the end of stream. * @throws IOException if an I/O error occurs. */ @Override @@ -228,8 +227,8 @@ public int read() throws IOException { /** * Invokes the delegate's {@link InputStream#read(byte[])} method. * - * @param b the buffer to read the bytes into - * @return the number of bytes read or {@link IOUtils#EOF EOF} if the end of stream + * @param b the buffer to read the bytes into. + * @return the number of bytes read or {@link IOUtils#EOF EOF} if we reached the end of stream. * @throws IOException *