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-compress.git
The following commit(s) were added to refs/heads/master by this push:
new f7a3d45d6 Use NIO
f7a3d45d6 is described below
commit f7a3d45d65de504beb0e2c48529fc06c9cc81037
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jan 14 15:59:39 2024 -0500
Use NIO
---
.../compressors/zstandard/ZstdCompressorInputStreamTest.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/compressors/zstandard/ZstdCompressorInputStreamTest.java
b/src/test/java/org/apache/commons/compress/compressors/zstandard/ZstdCompressorInputStreamTest.java
index 51d00037b..888d6427b 100644
---
a/src/test/java/org/apache/commons/compress/compressors/zstandard/ZstdCompressorInputStreamTest.java
+++
b/src/test/java/org/apache/commons/compress/compressors/zstandard/ZstdCompressorInputStreamTest.java
@@ -153,34 +153,30 @@ public class ZstdCompressorInputStreamTest extends
AbstractTest {
@Test
public void testZstdDecodeWithNoPool() throws IOException {
final File input = getFile("zstandard.testdata.zst");
- final File expected = getFile("zstandard.testdata");
try (InputStream inputStream = Files.newInputStream(input.toPath());
ZstdCompressorInputStream zstdInputStream = new
ZstdCompressorInputStream(inputStream, NoPool.INSTANCE)) {
- final byte[] b = new byte[97];
- IOUtils.read(expected, b);
+ final byte[] expected =
Files.readAllBytes(getPath("zstandard.testdata"));
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
int readByte = -1;
while ((readByte = zstdInputStream.read()) != -1) {
bos.write(readByte);
}
- assertArrayEquals(b, bos.toByteArray());
+ assertArrayEquals(expected, bos.toByteArray());
}
}
@Test
public void testZstdDecodeWithRecyclingBufferPool() throws IOException {
final File input = getFile("zstandard.testdata.zst");
- final File expected = getFile("zstandard.testdata");
try (InputStream inputStream = Files.newInputStream(input.toPath());
ZstdCompressorInputStream zstdInputStream = new
ZstdCompressorInputStream(inputStream, RecyclingBufferPool.INSTANCE)) {
- final byte[] b = new byte[97];
- IOUtils.read(expected, b);
+ final byte[] expected =
Files.readAllBytes(getPath("zstandard.testdata"));
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
int readByte = -1;
while ((readByte = zstdInputStream.read()) != -1) {
bos.write(readByte);
}
- assertArrayEquals(b, bos.toByteArray());
+ assertArrayEquals(expected, bos.toByteArray());
}
}