This is an automated email from the ASF dual-hosted git repository. kinow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit 9400501cfc581471017d65b0e6ca77299db9f5ba Author: richard <ra22...@gmail.com> AuthorDate: Thu Mar 24 21:03:04 2022 +0000 [IO-697] Fix IOUtils.toByteArray documentation. --- src/main/java/org/apache/commons/io/IOUtils.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/io/IOUtils.java b/src/main/java/org/apache/commons/io/IOUtils.java index 6c6a007..586e1ed 100644 --- a/src/main/java/org/apache/commons/io/IOUtils.java +++ b/src/main/java/org/apache/commons/io/IOUtils.java @@ -2497,13 +2497,13 @@ public class IOUtils { /** * Gets the contents of an {@code InputStream} as a {@code byte[]}. Use this method instead of - * {@code toByteArray(InputStream)} when {@code InputStream} size is known + * {@code toByteArray(InputStream)} when {@code InputStream} size is known. * * @param input the {@code InputStream} to read. - * @param size the size of {@code InputStream}. - * @return the requested byte array. - * @throws IOException if an I/O error occurs or {@code InputStream} size differ from parameter size. - * @throws IllegalArgumentException if size is less than zero. + * @param size the size of {@code InputStream} to read, where 0 < {@code size} <= length of input stream. + * @return byte [] of length {@code size}. + * @throws IOException if an I/O error occurs or {@code InputStream} length is smaller than parameter {@code size}. + * @throws IllegalArgumentException if {@code size} is less than zero. * @since 2.1 */ public static byte[] toByteArray(final InputStream input, final int size) throws IOException { @@ -2540,10 +2540,9 @@ public class IOUtils { * (Arrays can have no more than Integer.MAX_VALUE entries anyway) * * @param input the {@code InputStream} to read from - * @param size the size of {@code InputStream} - * @return the requested byte array - * @throws IOException if an I/O error occurs or {@code InputStream} size differ from parameter - * size + * @param size the size of {@code InputStream} to read, where 0 < {@code size} <= min(Integer.MAX_VALUE, length of input stream). + * @return byte [] the requested byte array, of length {@code size} + * @throws IOException if an I/O error occurs or {@code InputStream} length is less than {@code size} * @throws IllegalArgumentException if size is less than zero or size is greater than Integer.MAX_VALUE * @see IOUtils#toByteArray(java.io.InputStream, int) * @since 2.1