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
commit 5eae1bb2c674fe96624313d7c170ab669f4d6c20 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Dec 11 07:48:38 2024 -0500 Port test to ... Java 7! --- .../apache/commons/compress/archivers/ArTest.java | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/archivers/ArTest.java b/src/test/java/org/apache/commons/compress/archivers/ArTest.java index a9f5f32c9..6884f5f77 100644 --- a/src/test/java/org/apache/commons/compress/archivers/ArTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/ArTest.java @@ -173,12 +173,7 @@ public final class ArTest extends AbstractTest { try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) { final ArArchiveEntry in = new ArArchiveEntry("foo", file.length(), 0, 0, 0, file.lastModified() / 1000); aos.putArchiveEntry(in); - final byte[] b = new byte[(int) file.length()]; - try (InputStream fis = Files.newInputStream(file.toPath())) { - while (fis.read(b) > 0) { - aos.write(b); - } - } + Files.copy(file.toPath(), aos); aos.closeArchiveEntry(); } // @@ -200,12 +195,7 @@ public final class ArTest extends AbstractTest { try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) { final ArArchiveEntry in = new ArArchiveEntry(file, "foo"); aos.putArchiveEntry(in); - final byte[] b = new byte[(int) file.length()]; - try (InputStream fis = Files.newInputStream(file.toPath())) { - while (fis.read(b) > 0) { - aos.write(b); - } - } + Files.copy(file.toPath(), aos); aos.closeArchiveEntry(); } final ArArchiveEntry out; @@ -227,12 +217,7 @@ public final class ArTest extends AbstractTest { try (ArArchiveOutputStream aos = new ArArchiveOutputStream(Files.newOutputStream(archive.toPath()))) { final ArArchiveEntry in = new ArArchiveEntry(file.toPath(), "foo"); aos.putArchiveEntry(in); - final byte[] b = new byte[(int) file.length()]; - try (InputStream fis = Files.newInputStream(file.toPath())) { - while (fis.read(b) > 0) { - aos.write(b); - } - } + Files.copy(file.toPath(), aos); aos.closeArchiveEntry(); } final ArArchiveEntry out;