ppkarwasz commented on code in PR #776:
URL: https://github.com/apache/commons-io/pull/776#discussion_r2325240868


##########
src/main/java/org/apache/commons/io/IOUtils.java:
##########
@@ -2659,35 +2660,61 @@ public static byte[] toByteArray(final InputStream 
inputStream) throws IOExcepti
     }
 
     /**
-     * Gets the contents of an {@link InputStream} as a {@code byte[]}. Use 
this method instead of
-     * {@link #toByteArray(InputStream)} when {@link InputStream} size is 
known.
+     * Reads exactly {@code size} bytes from the given {@link InputStream} 
into a new {@code byte[]}.
      *
-     * @param input the {@link InputStream} to read.
-     * @param size the size of {@link 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 {@link InputStream} 
length is smaller than parameter {@code size}.
-     * @throws IllegalArgumentException if {@code size} is less than zero.
+     * <p>
+     *   This variant allocates the target array immediately and attempts to 
fill it in one pass.
+     *   It assumes that {@code size} is correct.
+     *   If the stream ends prematurely, an {@link EOFException} is thrown.

Review Comment:
   Fixed in 
https://github.com/apache/commons-io/pull/776/commits/7362d3e34801662b029ea6ef4e005dfb1194c57b



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to