From e4513af88e11dd106fbabe58c54bd3a25f06fa57 Mon Sep 17 00:00:00 2001
From: ag2s20150909
+ * This method buffers the input internally, so there is no need to use a
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * This method uses {@link InputStreamReader}.
+ *
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * This method uses {@link InputStreamReader}.
+ *
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Character encoding names can be found at
+ * IANA.
+ *
+ * This method uses {@link InputStreamReader}.
+ *
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Large streams (over 2GB) will return a chars copied value of
+ *
+ * This method uses the provided buffer, so there is no need to use a
+ *
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Due to the implementation of OutputStreamWriter, this method performs a
+ * flush.
+ *
+ * This method uses {@link OutputStreamWriter}.
+ *
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Due to the implementation of OutputStreamWriter, this method performs a
+ * flush.
+ *
+ * This method uses {@link OutputStreamWriter}.
+ *
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Character encoding names can be found at
+ * IANA.
+ *
+ * Due to the implementation of OutputStreamWriter, this method performs a
+ * flush.
+ *
+ * This method uses {@link OutputStreamWriter}.
*
- * @param in f
- * @param out f
- * @return the nr of characters read, or -1 if the amount > Integer.MAX_VALUE
- * @throws IOException f
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Large streams (over 2GB) will return a chars copied value of
+ *
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
+ *
+ * This method uses the provided buffer, so there is no need to use a
+ *
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * Note that the implementation uses {@link #skip(InputStream, long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of characters are skipped.
+ *
+ * This method uses the provided buffer, so there is no need to use a
+ *
+ * Note that the implementation uses {@link #skip(InputStream, long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of characters are skipped.
+ *
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
+ *
+ * @param input the
+ * This method uses the provided buffer, so there is no need to use a
+ *
+ *
+ * @param input the
+ * This method buffers the input internally, so there is no need to use a
+ *
+ * The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
+ *
+ * @param input the
+ * This method uses the provided buffer, so there is no need to use a
+ *
+ *
+ * @param input the
+ * Note that the implementation uses {@link InputStream#read(byte[], int, int)} rather
+ * than delegating to {@link InputStream#skip(long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of bytes are skipped.
+ *
+ * Note that the implementation uses {@link Reader#read(char[], int, int)} rather
+ * than delegating to {@link Reader#skip(long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of characters are skipped.
+ *
+ * This allows for the possibility that {@link InputStream#skip(long)} may
+ * not skip as many bytes as requested (most likely because of reaching EOF).
+ *
+ * Note that the implementation uses {@link #skip(InputStream, long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of characters are skipped.
+ *
+ * This allows for the possibility that {@link Reader#skip(long)} may
+ * not skip as many characters as requested (most likely because of reaching EOF).
+ *
+ * Note that the implementation uses {@link #skip(Reader, long)}.
+ * This means that the method may be considerably less efficient than using the actual skip implementation,
+ * this is done to guarantee that the correct number of characters are skipped.
+ * InputStream
to an OutputStream
using an internal buffer of the
+ * given size.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the OutputStream
to write to
+ * @param bufferSize the bufferSize used to copy from the input to the output
+ * @return the number of bytes copied. or {@code 0} if {@code input is null}.
+ * @throws NullPointerException if the output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.5
+ */
+ public static long copy(final InputStream input, final OutputStream output, final int bufferSize)
+ throws IOException {
+ return copyLarge(input, output, new byte[bufferSize]);
+ }
+
+ /**
+ * Copies bytes from an InputStream
to chars on a
+ * Writer
using the default character encoding of the platform.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the Writer
to write to
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 1.1
+ * @deprecated 2.5 use {@link #copy(InputStream, Writer, Charset)} instead
+ */
+ @Deprecated
+ public static void copy(final InputStream input, final Writer output)
+ throws IOException {
+ copy(input, output, Charset.defaultCharset());
+ }
+
+ /**
+ * Copies bytes from an InputStream
to chars on a
+ * Writer
using the specified character encoding.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the Writer
to write to
+ * @param inputCharset the charset to use for the input stream, null means platform default
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.3
+ */
+ public static void copy(final InputStream input, final Writer output, final Charset inputCharset)
+ throws IOException {
+ final InputStreamReader in = new InputStreamReader(input, inputCharset.name());
+ copy(in, output);
+ }
+
+ /**
+ * Copies bytes from an InputStream
to chars on a
+ * Writer
using the specified character encoding.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the Writer
to write to
+ * @param inputCharsetName the name of the requested charset for the InputStream, null means platform default
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link java.io
+ * .UnsupportedEncodingException} in version 2.2 if the
+ * encoding is not supported.
+ * @since 1.1
*/
- public static int copy(InputStream in, OutputStream out)
+ public static void copy(final InputStream input, final Writer output, final String inputCharsetName)
throws IOException {
- byte[] buffer = new byte[IO_COPY_BUFFER_SIZE];
- int readSize;
- int result = 0;
- while ((readSize = in.read(buffer)) >= 0) {
- out.write(buffer, 0, readSize);
- result = calcNewNrReadSize(readSize, result);
+ copy(input, output,Charset.forName(inputCharsetName));
+ }
+
+ /**
+ * Copies chars from a Reader
to a Appendable
.
+ * BufferedReader
.
+ * -1
after the copy has completed since the correct
+ * number of chars cannot be returned as an int. For large streams
+ * use the copyLarge(Reader, Writer)
method.
+ *
+ * @param input the Reader
to read from
+ * @param output the Appendable
to write to
+ * @return the number of characters copied, or -1 if > Integer.MAX_VALUE
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.7
+ */
+ public static long copy(final Reader input, final Appendable output) throws IOException {
+ return copy(input, output, CharBuffer.allocate(DEFAULT_BUFFER_SIZE));
+ }
+
+ /**
+ * Copies chars from a Reader
to an Appendable
.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the Appendable
to write to
+ * @param buffer the buffer to be used for the copy
+ * @return the number of characters copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.7
+ */
+ public static long copy(final Reader input, final Appendable output, final CharBuffer buffer) throws IOException {
+ long count = 0;
+ int n;
+ while (EOF != (n = input.read(buffer))) {
+ buffer.flip();
+ output.append(buffer, 0, n);
+ count += n;
}
+ return count;
+ }
+
+ /**
+ * Copies chars from a Reader
to bytes on an
+ * OutputStream
using the default character encoding of the
+ * platform, and calling flush.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the OutputStream
to write to
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 1.1
+ * @deprecated 2.5 use {@link #copy(Reader, OutputStream, Charset)} instead
+ */
+ @Deprecated
+ public static void copy(final Reader input, final OutputStream output)
+ throws IOException {
+ copy(input, output, Charset.defaultCharset());
+ }
+
+ /**
+ * Copies chars from a Reader
to bytes on an
+ * OutputStream
using the specified character encoding, and
+ * calling flush.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the OutputStream
to write to
+ * @param outputCharset the charset to use for the OutputStream, null means platform default
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.3
+ */
+ public static void copy(final Reader input, final OutputStream output, final Charset outputCharset)
+ throws IOException {
+ final OutputStreamWriter out = new OutputStreamWriter(output, outputCharset.name());
+ copy(input, out);
+ // XXX Unless anyone is planning on rewriting OutputStreamWriter,
+ // we have to flush here.
out.flush();
- return result;
}
/**
- * Copies the contents of the Reader to the Writer.
+ * Copies chars from a Reader
to bytes on an
+ * OutputStream
using the specified character encoding, and
+ * calling flush.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the OutputStream
to write to
+ * @param outputCharsetName the name of the requested charset for the OutputStream, null means platform default
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @throws java.nio.charset.UnsupportedCharsetException thrown instead of {@link java.io
+ * .UnsupportedEncodingException} in version 2.2 if the
+ * encoding is not supported.
+ * @since 1.1
*/
- public static int copy(Reader in, Writer out) throws IOException {
- char[] buffer = new char[IO_COPY_BUFFER_SIZE];
- int readSize;
- int result = 0;
- while ((readSize = in.read(buffer)) >= 0) {
- out.write(buffer, 0, readSize);
- result = calcNewNrReadSize(readSize, result);
+ public static void copy(final Reader input, final OutputStream output, final String outputCharsetName)
+ throws IOException {
+ copy(input, output, Charset.forName(outputCharsetName));
+ }
+
+ /**
+ * Copies chars from a Reader
to a Writer
.
+ * BufferedReader
.
+ * -1
after the copy has completed since the correct
+ * number of chars cannot be returned as an int. For large streams
+ * use the copyLarge(Reader, Writer)
method.
+ *
+ * @param input the Reader
to read from
+ * @param output the Writer
to write to
+ * @return the number of characters copied, or -1 if > Integer.MAX_VALUE
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 1.1
+ */
+ public static int copy(final Reader input, final Writer output) throws IOException {
+ final long count = copyLarge(input, output);
+ if (count > Integer.MAX_VALUE) {
+ return -1;
+ }
+ return (int) count;
+ }
+
+ /**
+ * Copies bytes from a large (over 2GB) InputStream
to an
+ * OutputStream
.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the OutputStream
to write to
+ * @return the number of bytes copied. or {@code 0} if {@code input is null}.
+ * @throws NullPointerException if the output is null
+ * @throws IOException if an I/O error occurs
+ * @since 1.3
+ */
+ public static long copyLarge(final InputStream input, final OutputStream output)
+ throws IOException {
+ return copy(input, output, DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * Copies bytes from a large (over 2GB) InputStream
to an
+ * OutputStream
.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the OutputStream
to write to
+ * @param buffer the buffer to use for the copy
+ * @return the number of bytes copied. or {@code 0} if {@code input is null}.
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final InputStream input, final OutputStream output, final byte[] buffer)
+ throws IOException {
+ long count = 0;
+ if (input != null) {
+ int n;
+ while (EOF != (n = input.read(buffer))) {
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Copies some or all bytes from a large (over 2GB) InputStream
to an
+ * OutputStream
, optionally skipping input bytes.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the OutputStream
to write to
+ * @param inputOffset : number of bytes to skip from input before copying
+ * -ve values are ignored
+ * @param length : number of bytes to copy. -ve means all
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final InputStream input, final OutputStream output, final long inputOffset,
+ final long length) throws IOException {
+ return copyLarge(input, output, inputOffset, length, new byte[DEFAULT_BUFFER_SIZE]);
+ }
+
+ /**
+ * Copies some or all bytes from a large (over 2GB) InputStream
to an
+ * OutputStream
, optionally skipping input bytes.
+ * BufferedInputStream
.
+ * InputStream
to read from
+ * @param output the OutputStream
to write to
+ * @param inputOffset : number of bytes to skip from input before copying
+ * -ve values are ignored
+ * @param length : number of bytes to copy. -ve means all
+ * @param buffer the buffer to use for the copy
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final InputStream input, final OutputStream output,
+ final long inputOffset, final long length, final byte[] buffer) throws IOException {
+ if (inputOffset > 0) {
+ skipFully(input, inputOffset);
+ }
+ if (length == 0) {
+ return 0;
+ }
+ final int bufferLength = buffer.length;
+ int bytesToRead = bufferLength;
+ if (length > 0 && length < bufferLength) {
+ bytesToRead = (int) length;
+ }
+ int read;
+ long totalRead = 0;
+ while (bytesToRead > 0 && EOF != (read = input.read(buffer, 0, bytesToRead))) {
+ output.write(buffer, 0, read);
+ totalRead += read;
+ if (length > 0) { // only adjust length if not reading to the end
+ // Note the cast must work because buffer.length is an integer
+ bytesToRead = (int) Math.min(length - totalRead, bufferLength);
+ }
+ }
+ return totalRead;
+ }
+
+ /**
+ * Copies chars from a large (over 2GB) Reader
to a Writer
.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the Writer
to write to
+ * @return the number of characters copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 1.3
+ */
+ public static long copyLarge(final Reader input, final Writer output) throws IOException {
+ return copyLarge(input, output, new char[DEFAULT_BUFFER_SIZE]);
+ }
+
+ /**
+ * Copies chars from a large (over 2GB) Reader
to a Writer
.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the Writer
to write to
+ * @param buffer the buffer to be used for the copy
+ * @return the number of characters copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final Reader input, final Writer output, final char[] buffer) throws IOException {
+ long count = 0;
+ int n;
+ while (EOF != (n = input.read(buffer))) {
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ return count;
+ }
+
+ /**
+ * Copies some or all chars from a large (over 2GB) InputStream
to an
+ * OutputStream
, optionally skipping input chars.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the Writer
to write to
+ * @param inputOffset : number of chars to skip from input before copying
+ * -ve values are ignored
+ * @param length : number of chars to copy. -ve means all
+ * @return the number of chars copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final Reader input, final Writer output, final long inputOffset, final long length)
+ throws IOException {
+ return copyLarge(input, output, inputOffset, length, new char[DEFAULT_BUFFER_SIZE]);
+ }
+
+ /**
+ * Copies some or all chars from a large (over 2GB) InputStream
to an
+ * OutputStream
, optionally skipping input chars.
+ * BufferedReader
.
+ * Reader
to read from
+ * @param output the Writer
to write to
+ * @param inputOffset : number of chars to skip from input before copying
+ * -ve values are ignored
+ * @param length : number of chars to copy. -ve means all
+ * @param buffer the buffer to be used for the copy
+ * @return the number of chars copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since 2.2
+ */
+ public static long copyLarge(final Reader input, final Writer output, final long inputOffset, final long length,
+ final char[] buffer)
+ throws IOException {
+ if (inputOffset > 0) {
+ skipFully(input, inputOffset);
+ }
+ if (length == 0) {
+ return 0;
+ }
+ int bytesToRead = buffer.length;
+ if (length > 0 && length < buffer.length) {
+ bytesToRead = (int) length;
+ }
+ int read;
+ long totalRead = 0;
+ while (bytesToRead > 0 && EOF != (read = input.read(buffer, 0, bytesToRead))) {
+ output.write(buffer, 0, read);
+ totalRead += read;
+ if (length > 0) { // only adjust length if not reading to the end
+ // Note the cast must work because buffer.length is an integer
+ bytesToRead = (int) Math.min(length - totalRead, buffer.length);
+ }
+ }
+ return totalRead;
+ }
+
+ /**
+ * Skips bytes from an input byte stream.
+ * This implementation guarantees that it will read as many bytes
+ * as possible before giving up; this may not always be the case for
+ * skip() implementations in subclasses of {@link InputStream}.
+ *
* See the protected methods for ways in which a subclass can easily decorate * a stream with custom pre-, post- or error processing functionality. - * - * @author Stephen Colebourne - * @version $Id: ProxyInputStream.java 934041 2010-04-14 17:37:24Z jukka $ + *
*/ public abstract class ProxyInputStream extends FilterInputStream { /** * Constructs a new ProxyInputStream. * - * @param proxy the InputStream to delegate to + * @param proxy the InputStream to delegate to */ - public ProxyInputStream(InputStream proxy) { + public ProxyInputStream(final InputStream proxy) { super(proxy); // the proxy is stored in a protected superclass variable named 'in' } /** * Invokes the delegate'sread()
method.
+ *
* @return the byte read or -1 if the end of stream
* @throws IOException if an I/O error occurs
*/
@@ -57,36 +63,38 @@ public abstract class ProxyInputStream extends FilterInputStream {
public int read() throws IOException {
try {
beforeRead(1);
- int b = in.read();
- afterRead(b != -1 ? 1 : -1);
+ final int b = in.read();
+ afterRead(b != EOF ? 1 : EOF);
return b;
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
- return -1;
+ return EOF;
}
}
/**
* Invokes the delegate's read(byte[])
method.
+ *
* @param bts the buffer to read the bytes into
- * @return the number of bytes read or -1 if the end of stream
+ * @return the number of bytes read or EOF if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
- public int read(byte[] bts) throws IOException {
+ public int read(final byte[] bts) throws IOException {
try {
- beforeRead(bts != null ? bts.length : 0);
- int n = in.read(bts);
+ beforeRead(IOUtil.length(bts));
+ final int n = in.read(bts);
afterRead(n);
return n;
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
- return -1;
+ return EOF;
}
}
/**
* Invokes the delegate's read(byte[], int, int)
method.
+ *
* @param bts the buffer to read the bytes into
* @param off The start offset
* @param len The number of bytes to read
@@ -94,29 +102,30 @@ public abstract class ProxyInputStream extends FilterInputStream {
* @throws IOException if an I/O error occurs
*/
@Override
- public int read(byte[] bts, int off, int len) throws IOException {
+ public int read(final byte[] bts, final int off, final int len) throws IOException {
try {
beforeRead(len);
- int n = in.read(bts, off, len);
+ final int n = in.read(bts, off, len);
afterRead(n);
return n;
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
- return -1;
+ return EOF;
}
}
/**
* Invokes the delegate's skip(long)
method.
+ *
* @param ln the number of bytes to skip
* @return the actual number of bytes skipped
* @throws IOException if an I/O error occurs
*/
@Override
- public long skip(long ln) throws IOException {
+ public long skip(final long ln) throws IOException {
try {
return in.skip(ln);
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
return 0;
}
@@ -124,6 +133,7 @@ public abstract class ProxyInputStream extends FilterInputStream {
/**
* Invokes the delegate's available()
method.
+ *
* @return the number of available bytes
* @throws IOException if an I/O error occurs
*/
@@ -131,7 +141,7 @@ public abstract class ProxyInputStream extends FilterInputStream {
public int available() throws IOException {
try {
return super.available();
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
return 0;
}
@@ -139,41 +149,41 @@ public abstract class ProxyInputStream extends FilterInputStream {
/**
* Invokes the delegate's close()
method.
+ *
* @throws IOException if an I/O error occurs
*/
@Override
public void close() throws IOException {
- try {
- in.close();
- } catch (IOException e) {
- handleIOException(e);
- }
+ IOUtil.close(in, this::handleIOException);
}
/**
* Invokes the delegate's mark(int)
method.
+ *
* @param readlimit read ahead limit
*/
@Override
- public synchronized void mark(int readlimit) {
+ public synchronized void mark(final int readlimit) {
in.mark(readlimit);
}
/**
* Invokes the delegate's reset()
method.
+ *
* @throws IOException if an I/O error occurs
*/
@Override
public synchronized void reset() throws IOException {
try {
in.reset();
- } catch (IOException e) {
+ } catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's markSupported()
method.
+ *
* @return true if mark is supported, otherwise false
*/
@Override
@@ -195,11 +205,13 @@ public abstract class ProxyInputStream extends FilterInputStream {
* {@link #reset()}. You need to explicitly override those methods if
* you want to add pre-processing steps also to them.
*
- * @since Commons IO 2.0
* @param n number of bytes that the caller asked to be read
+ * @since 2.0
*/
@SuppressWarnings("unused")
- protected void beforeRead(int n) {
+
+ protected void beforeRead(final int n) {
+ // no-op
}
/**
@@ -215,23 +227,25 @@ public abstract class ProxyInputStream extends FilterInputStream {
* {@link #reset()}. You need to explicitly override those methods if
* you want to add post-processing steps also to them.
*
- * @since Commons IO 2.0
* @param n number of bytes read, or -1 if the end of stream was reached
+ * @since 2.0
*/
@SuppressWarnings("unused")
- protected void afterRead(int n) {
+ protected void afterRead(final int n) {
+ // no-op
}
/**
* Handle any IOExceptions thrown.
* * This method provides a point to implement custom exception - * handling. The default behaviour is to re-throw the exception. + * handling. The default behavior is to re-throw the exception. + * * @param e The IOException thrown * @throws IOException if an I/O error occurs - * @since Commons IO 2.0 + * @since 2.0 */ - protected void handleIOException(IOException e) throws IOException { + protected void handleIOException(final IOException e) throws IOException { throw e; }