Skip to content

Commit 3e7f7ef

Browse files
committed
Use IOUtils.copyLarge() in XXHash32Test
1 parent c60cf6f commit 3e7f7ef

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/test/java/org/apache/commons/codec/digest/XXHash32Test.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,15 @@
2929
import java.net.URL;
3030
import java.util.stream.Stream;
3131

32+
import org.apache.commons.io.IOUtils;
3233
import org.junit.jupiter.params.ParameterizedTest;
3334
import org.junit.jupiter.params.provider.Arguments;
3435
import org.junit.jupiter.params.provider.MethodSource;
3536

3637
public class XXHash32Test {
3738

3839
private static long copy(final InputStream input, final OutputStream output, final int bufferSize) throws IOException {
39-
final byte[] buffer = new byte[bufferSize];
40-
int n = 0;
41-
long count = 0;
42-
while (-1 != (n = input.read(buffer))) {
43-
output.write(buffer, 0, n);
44-
count += n;
45-
}
46-
return count;
40+
return IOUtils.copyLarge(input, output, new byte[bufferSize]);
4741
}
4842

4943
public static Stream<Arguments> data() {

0 commit comments

Comments
 (0)