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 13d80b8f4 Reuse NIO API instead of custom code
13d80b8f4 is described below
commit 13d80b8f459555997caccd8378da30a01f8cf8a4
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Nov 14 13:53:39 2023 -0500
Reuse NIO API instead of custom code
---
.../apache/commons/compress/archivers/examples/ExpanderTest.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
index 72c3cb935..b8bf54f1a 100644
---
a/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
+++
b/src/test/java/org/apache/commons/compress/archivers/examples/ExpanderTest.java
@@ -46,7 +46,6 @@ import
org.apache.commons.compress.archivers.sevenz.SevenZFile;
import org.apache.commons.compress.archivers.sevenz.SevenZOutputFile;
import org.apache.commons.compress.archivers.tar.TarFile;
import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.commons.compress.utils.IOUtils;
import org.junit.jupiter.api.Test;
public class ExpanderTest extends AbstractTest {
@@ -56,10 +55,8 @@ public class ExpanderTest extends AbstractTest {
private void assertHelloWorld(final String fileName, final String suffix)
throws IOException {
assertTrue(new File(tempResultDir, fileName).isFile(), fileName + "
does not exist");
final byte[] expected = ("Hello, world " + suffix).getBytes(UTF_8);
- try (InputStream is = Files.newInputStream(new File(tempResultDir,
fileName).toPath())) {
- final byte[] actual = IOUtils.toByteArray(is);
- assertArrayEquals(expected, actual);
- }
+ final byte[] actual =
Files.readAllBytes(tempResultDir.toPath().resolve(fileName));
+ assertArrayEquals(expected, actual);
}
private void setup7z() throws IOException {