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-codec.git
commit 715ecb7ec7ae8da1c07c4ebd0a3dcb1a854deea6 Author: Gary Gregory <[email protected]> AuthorDate: Sat Mar 7 08:07:34 2026 -0500 Reuse IOUtils.toByteArray(InputStream) --- .../java/org/apache/commons/codec/binary/BaseNTestData.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/codec/binary/BaseNTestData.java b/src/test/java/org/apache/commons/codec/binary/BaseNTestData.java index 379e79e0..bbd562b2 100644 --- a/src/test/java/org/apache/commons/codec/binary/BaseNTestData.java +++ b/src/test/java/org/apache/commons/codec/binary/BaseNTestData.java @@ -17,11 +17,12 @@ package org.apache.commons.codec.binary; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Random; +import org.apache.commons.io.IOUtils; + /** * Data and functions common to BaseN tests. */ @@ -140,13 +141,7 @@ public class BaseNTestData { * @throws IOException if an error occurs whilst reading the input stream */ static byte[] streamToBytes(final InputStream in) throws IOException { - final ByteArrayOutputStream os = new ByteArrayOutputStream(); - final byte[] buf = new byte[4096]; - int read; - while ((read = in.read(buf)) > -1) { - os.write(buf, 0, read); - } - return os.toByteArray(); + return IOUtils.toByteArray(in); } /**
