Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Aug 6, 2024
1 parent 3ee38ba commit a7e7dda
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/main/java/org/apache/commons/io/input/ProxyInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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.
* <p>
* Subclasses can override this method to add common post-processing
Expand All @@ -93,7 +92,7 @@ public ProxyInputStream(final InputStream proxy) {
* </p>
*
* @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.
Expand Down Expand Up @@ -162,7 +161,7 @@ public void close() throws IOException {
* handling. The default behavior is to re-throw the exception.
* </p>
*
* @param e The IOException thrown
* @param e The IOException thrown.
* @throws IOException if an I/O error occurs.
* @since 2.0
*/
Expand All @@ -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) {
Expand All @@ -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
Expand All @@ -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
* <ul>
* <li>If the first byte cannot be read for any reason other than the end of the file,
Expand All @@ -253,10 +252,10 @@ public int read(final byte[] b) throws IOException {
/**
* Invokes the delegate's {@link InputStream#read(byte[], int, int)} method.
*
* @param b the buffer to read the bytes into
* @param off The start offset
* @param len The number of bytes to read
* @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.
* @param off The start offset.
* @param len The number of bytes to read.
* @return the number of bytes read or {@link IOUtils#EOF EOF} if we reached the end of stream.
* @throws IOException
* <ul>
* <li>If the first byte cannot be read for any reason other than the end of the file,
Expand All @@ -280,7 +279,7 @@ public int read(final byte[] b, final int off, final int len) throws IOException
/**
* Invokes the delegate's {@link InputStream#reset()} method.
*
* @throws IOException if an I/O error occurs.
* @throws IOException if this stream has not been marked or if the mark has been invalidated.
*/
@Override
public synchronized void reset() throws IOException {
Expand All @@ -303,9 +302,9 @@ void setIn(final InputStream in) {
/**
* Invokes the delegate's {@link InputStream#skip(long)} method.
*
* @param n the number of bytes to skip
* @return the actual number of bytes skipped
* @throws IOException if an I/O error occurs.
* @param n the number of bytes to skip.
* @return the actual number of bytes skipped.
* @throws IOException if the stream does not support seek, or if some other I/O error occurs.
*/
@Override
public long skip(final long n) throws IOException {
Expand Down

0 comments on commit a7e7dda

Please sign in to comment.