You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/01/25 16:55:34 UTC
[commons-compress] 04/06: Reuse own CloseShieldFilterInputStream
instead of creating an anonymous inner class.
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 81b0b1bad8c64f80f73148c16a00674f1ea997bf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 25 11:29:33 2020 -0500
Reuse own CloseShieldFilterInputStream instead of creating an anonymous
inner class.
---
.../compress/archivers/zip/ExplodingInputStream.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
index 0c899f9..24a0920 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ExplodingInputStream.java
@@ -19,12 +19,13 @@
package org.apache.commons.compress.archivers.zip;
-import org.apache.commons.compress.utils.CountingInputStream;
-import org.apache.commons.compress.utils.InputStreamStatistics;
-
import java.io.IOException;
import java.io.InputStream;
+import org.apache.commons.compress.utils.CloseShieldFilterInputStream;
+import org.apache.commons.compress.utils.CountingInputStream;
+import org.apache.commons.compress.utils.InputStreamStatistics;
+
/**
* The implode compression method was added to PKZIP 1.01 released in 1989.
* It was then dropped from PKZIP 2.0 released in 1993 in favor of the deflate
@@ -97,12 +98,8 @@ class ExplodingInputStream extends InputStream implements InputStreamStatistics
*/
private void init() throws IOException {
if (bits == null) {
- try (CountingInputStream i = new CountingInputStream(in) {
- @Override
- public void close() {
- // we do not want to close in
- }
- }) {
+ // we do not want to close in
+ try (CountingInputStream i = new CountingInputStream(new CloseShieldFilterInputStream(in))) {
if (numberOfTrees == 3) {
literalTree = BinaryTree.decode(i, 256);
}