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 07c54a9 Javadoc exceptions. 07c54a9 is described below commit 07c54a9f68873c34873e328dc937eab34b5949b1 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Tue Jan 19 10:37:56 2021 -0500 Javadoc exceptions. --- src/main/java/org/apache/commons/io/FileUtils.java | 10 +++--- src/main/java/org/apache/commons/io/IOUtils.java | 40 ++++++++++------------ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java index 313a4a9..77cdffb 100644 --- a/src/main/java/org/apache/commons/io/FileUtils.java +++ b/src/main/java/org/apache/commons/io/FileUtils.java @@ -860,7 +860,7 @@ public class FileUtils { * @return the number of bytes copied * @throws NullPointerException if the File is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 2.1 */ public static long copyFile(final File input, final OutputStream output) throws IOException { @@ -1028,10 +1028,10 @@ public class FileUtils { * {@code null} * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the File is {@code null}. - * @throws IOException if <code>destination</code> is a directory - * @throws IOException if <code>destination</code> cannot be written - * @throws IOException if <code>destination</code> needs creating but can't be - * @throws IOException if an IO error occurs during copying + * @throws IllegalArgumentException if the file object is a directory. + * @throws IllegalArgumentException if the file is not writable. + * @throws IOException if the directories could not be created. + * @throws IOException if an IO error occurs during copying. * @since 2.5 */ public static void copyToFile(final InputStream inputStream, final File file) throws IOException { diff --git a/src/main/java/org/apache/commons/io/IOUtils.java b/src/main/java/org/apache/commons/io/IOUtils.java index cba42b2..2795a71 100644 --- a/src/main/java/org/apache/commons/io/IOUtils.java +++ b/src/main/java/org/apache/commons/io/IOUtils.java @@ -721,7 +721,7 @@ public class IOUtils { * @return the number of bytes copied. or {@code 0} if {@code input is null}. * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 2.8.0 */ public static long consume(final InputStream input) @@ -842,17 +842,14 @@ public class IOUtils { } /** - * Copies bytes from an <code>InputStream</code> to an - * <code>OutputStream</code>. + * Copies bytes from an <code>InputStream</code> to an <code>OutputStream</code>. * <p> - * This method buffers the input internally, so there is no need to use a - * <code>BufferedInputStream</code>. + * This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. * </p> * <p> - * Large streams (over 2GB) will return a bytes copied value of - * <code>-1</code> after the copy has completed since the correct - * number of bytes cannot be returned as an int. For large streams - * use the <code>copyLarge(InputStream, OutputStream)</code> method. + * Large streams (over 2GB) will return a bytes copied value of <code>-1</code> after the copy has completed since + * the correct number of bytes cannot be returned as an int. For large streams use the + * <code>copyLarge(InputStream, OutputStream)</code> method. * </p> * * @param inputStream the <code>InputStream</code> to read. @@ -860,7 +857,7 @@ public class IOUtils { * @return the number of bytes copied, or -1 if > Integer.MAX_VALUE. * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 1.1 */ public static int copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { @@ -884,7 +881,7 @@ public class IOUtils { * @return the number of bytes copied. * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 2.5 */ public static long copy(final InputStream inputStream, final OutputStream outputStream, final int bufferSize) @@ -1142,7 +1139,7 @@ public class IOUtils { * @return the number of bytes copied. * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 1.3 */ public static long copyLarge(final InputStream inputStream, final OutputStream outputStream) @@ -1164,7 +1161,7 @@ public class IOUtils { * @return the number of bytes copied. * @throws NullPointerException if the InputStream is {@code null}. * @throws NullPointerException if the OutputStream is {@code null}. - * @throws IOException if an I/O error occurs + * @throws IOException if an I/O error occurs. * @since 2.2 */ @SuppressWarnings("resource") // streams are closed by the caller. @@ -2248,13 +2245,14 @@ public class IOUtils { * <code>BufferedInputStream</code>. * </p> * - * @param input the <code>InputStream</code> to read from + * @param inputStream the <code>InputStream</code> to read. * @return the requested byte array - * @throws IOException if an I/O error occurs + * @throws NullPointerException if the InputStream is {@code null}. + * @throws IOException if an I/O error occurs. */ - public static byte[] toByteArray(final InputStream input) throws IOException { + public static byte[] toByteArray(final InputStream inputStream) throws IOException { try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) { - copy(input, output); + copy(inputStream, output); return output.toByteArray(); } } @@ -2436,10 +2434,10 @@ public class IOUtils { /** * Gets the contents of a <code>URLConnection</code> as a <code>byte[]</code>. * - * @param urlConn the <code>URLConnection</code> to read - * @return the requested byte array - * @throws NullPointerException if the urlConn is null - * @throws IOException if an I/O exception occurs + * @param urlConn the <code>URLConnection</code> to read. + * @return the requested byte array. + * @throws NullPointerException if the urlConn is null. + * @throws IOException if an I/O exception occurs. * @since 2.4 */ public static byte[] toByteArray(final URLConnection urlConn) throws IOException {