Skip to content

Commit 4dc17b6

Browse files
committed
Deprecate IOUtils.readFully(InputStream, int) in favor of
toByteArray(InputStream, int)
1 parent d93aff5 commit 4dc17b6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The <action> type attribute can be add,update,fix,remove.
5252
<action type="fix" dev="ggregory" due-to="Stanislav Fort, Gary Gregory">ValidatingObjectInputStream does not validate dynamic proxy interfaces.</action>
5353
<action type="fix" dev="pkarwasz" due-to="Piotr P. Karwasz">BoundedInputStream.getRemaining() now reports Long.MAX_VALUE instead of 0 when no limit is set.</action>
5454
<action type="fix" dev="pkarwasz" due-to="Piotr P. Karwasz">BoundedInputStream.available() correctly accounts for the maximum read limit.</action>
55+
<action type="fix" dev="ggregory" due-to="Gary Gregory, Piotr P. Karwasz">Deprecate IOUtils.readFully(InputStream, int) in favor of toByteArray(InputStream, int).</action>
5556
<!-- ADD -->
5657
<action dev="ggregory" type="add" due-to="strangelookingnerd, Gary Gregory">FileUtils#byteCountToDisplaySize() supports Zettabyte, Yottabyte, Ronnabyte and Quettabyte #763.</action>
5758
<action dev="ggregory" type="add" due-to="strangelookingnerd, Gary Gregory">Add org.apache.commons.io.FileUtils.ONE_RB #763.</action>

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,11 +2030,11 @@ public static void readFully(final InputStream input, final byte[] buffer, final
20302030
* @throws IllegalArgumentException if length is negative.
20312031
* @throws EOFException if the number of bytes read was incorrect.
20322032
* @since 2.5
2033+
* @deprecated Use {@link #toByteArray(InputStream, int)}.
20332034
*/
2035+
@Deprecated
20342036
public static byte[] readFully(final InputStream input, final int length) throws IOException {
2035-
final byte[] buffer = byteArray(length);
2036-
readFully(input, buffer, 0, buffer.length);
2037-
return buffer;
2037+
return toByteArray(input, length);
20382038
}
20392039

20402040
/**

0 commit comments

Comments
 (0)