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


The following commit(s) were added to refs/heads/master by this push:
     new 3e7f7ef1 Use IOUtils.copyLarge() in XXHash32Test
3e7f7ef1 is described below

commit 3e7f7ef11d1b7656c0f13675b8e27602e2624b9c
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sat Mar 1 10:37:23 2025 -0500

    Use IOUtils.copyLarge() in XXHash32Test
---
 .../java/org/apache/commons/codec/digest/XXHash32Test.java     | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/test/java/org/apache/commons/codec/digest/XXHash32Test.java 
b/src/test/java/org/apache/commons/codec/digest/XXHash32Test.java
index ee8a2b93..0d0bda92 100644
--- a/src/test/java/org/apache/commons/codec/digest/XXHash32Test.java
+++ b/src/test/java/org/apache/commons/codec/digest/XXHash32Test.java
@@ -29,6 +29,7 @@ import java.net.URI;
 import java.net.URL;
 import java.util.stream.Stream;
 
+import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -36,14 +37,7 @@ import org.junit.jupiter.params.provider.MethodSource;
 public class XXHash32Test {
 
     private static long copy(final InputStream input, final OutputStream 
output, final int bufferSize) throws IOException {
-        final byte[] buffer = new byte[bufferSize];
-        int n = 0;
-        long count = 0;
-        while (-1 != (n = input.read(buffer))) {
-            output.write(buffer, 0, n);
-            count += n;
-        }
-        return count;
+        return IOUtils.copyLarge(input, output, new byte[bufferSize]);
     }
 
     public static Stream<Arguments> data() {

Reply via email to