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 f466e04ed532e4d539232c3e6d2813ae955d0574 Author: Gary Gregory <[email protected]> AuthorDate: Fri Jun 28 16:30:02 2024 -0400 Upgrade commons-io from 2.15.1 to 2.16.1 #513 - Migrate to non-deprecated code - Thanks to madrob Mike Drob and PR 513 - https://github.com/apache/commons-compress/pull/513/files --- .../compress/archivers/zip/ScatterZipOutputStream.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java index b3020ea5b..dd7602b75 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java @@ -30,7 +30,7 @@ import java.util.zip.Deflater; import org.apache.commons.compress.parallel.FileBasedScatterGatherBackingStore; import org.apache.commons.compress.parallel.ScatterGatherBackingStore; -import org.apache.commons.compress.utils.BoundedInputStream; +import org.apache.commons.io.input.BoundedInputStream; /** * A ZIP output stream that is optimized for multi-threaded scatter/gather construction of ZIP files. @@ -97,9 +97,15 @@ public class ScatterZipOutputStream implements Closeable { public void writeNextZipEntry(final ZipArchiveOutputStream target) throws IOException { final CompressedEntry compressedEntry = itemsIterator.next(); - try (BoundedInputStream rawStream = new BoundedInputStream(itemsIteratorData, compressedEntry.compressedSize)) { + // @formatter:off + try (BoundedInputStream rawStream = BoundedInputStream.builder() + .setInputStream(itemsIteratorData) + .setMaxCount(compressedEntry.compressedSize) + .setPropagateClose(false) + .get()) { target.addRawArchiveEntry(compressedEntry.transferToArchiveEntry(), rawStream); } + // @formatter:on } } @@ -214,9 +220,15 @@ public class ScatterZipOutputStream implements Closeable { backingStore.closeForWriting(); try (InputStream data = backingStore.getInputStream()) { for (final CompressedEntry compressedEntry : items) { - try (BoundedInputStream rawStream = new BoundedInputStream(data, compressedEntry.compressedSize)) { + // @formatter:off + try (BoundedInputStream rawStream = BoundedInputStream.builder() + .setInputStream(data) + .setMaxCount(compressedEntry.compressedSize) + .setPropagateClose(false) + .get()) { target.addRawArchiveEntry(compressedEntry.transferToArchiveEntry(), rawStream); } + // @formatter:on } } }
