You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/05/07 06:44:01 UTC
commons-compress git commit: findbugs doesn't like the class
shadowing its superclass' name
Repository: commons-compress
Updated Branches:
refs/heads/master 77addfc26 -> 446555b16
findbugs doesn't like the class shadowing its superclass' name
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/446555b1
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/446555b1
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/446555b1
Branch: refs/heads/master
Commit: 446555b160d4221d414710ea97a3140f50f889c6
Parents: 77addfc
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon May 7 08:43:31 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon May 7 08:43:31 2018 +0200
----------------------------------------------------------------------
.../archivers/zip/InflaterInputStream.java | 82 -------------------
.../zip/InflaterInputStreamWithStatistics.java | 83 ++++++++++++++++++++
.../commons/compress/archivers/zip/ZipFile.java | 2 +-
3 files changed, 84 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/446555b1/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStream.java
deleted file mode 100644
index 32d20e3..0000000
--- a/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStream.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.commons.compress.archivers.zip;
-
-import org.apache.commons.compress.utils.InputStreamStatistics;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.Inflater;
-
-/**
- * Helper class to provide statistics
- *
- * @since 1.17
- */
-/* package */ class InflaterInputStream extends java.util.zip.InflaterInputStream
- implements InputStreamStatistics {
- private long compressedCount = 0;
- private long uncompressedCount = 0;
-
- public InflaterInputStream(InputStream in) {
- super(in);
- }
-
- public InflaterInputStream(InputStream in, Inflater inf) {
- super(in, inf);
- }
-
- public InflaterInputStream(InputStream in, Inflater inf, int size) {
- super(in, inf, size);
- }
-
- @Override
- protected void fill() throws IOException {
- super.fill();
- compressedCount += inf.getRemaining();
- }
-
- @Override
- public int read() throws IOException {
- final int b = super.read();
- if (b > -1) {
- uncompressedCount++;
- }
- return b;
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- final int bytes = super.read(b, off, len);
- if (bytes > -1) {
- uncompressedCount += bytes;
- }
- return bytes;
- }
-
- @Override
- public long getCompressedCount() {
- return compressedCount;
- }
-
- @Override
- public long getUncompressedCount() {
- return uncompressedCount;
- }
-}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/446555b1/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStreamWithStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStreamWithStatistics.java b/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStreamWithStatistics.java
new file mode 100644
index 0000000..b10590f
--- /dev/null
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/InflaterInputStreamWithStatistics.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.commons.compress.archivers.zip;
+
+import org.apache.commons.compress.utils.InputStreamStatistics;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.Inflater;
+import java.util.zip.InflaterInputStream;
+
+/**
+ * Helper class to provide statistics
+ *
+ * @since 1.17
+ */
+/* package */ class InflaterInputStreamWithStatistics extends InflaterInputStream
+ implements InputStreamStatistics {
+ private long compressedCount = 0;
+ private long uncompressedCount = 0;
+
+ public InflaterInputStreamWithStatistics(InputStream in) {
+ super(in);
+ }
+
+ public InflaterInputStreamWithStatistics(InputStream in, Inflater inf) {
+ super(in, inf);
+ }
+
+ public InflaterInputStreamWithStatistics(InputStream in, Inflater inf, int size) {
+ super(in, inf, size);
+ }
+
+ @Override
+ protected void fill() throws IOException {
+ super.fill();
+ compressedCount += inf.getRemaining();
+ }
+
+ @Override
+ public int read() throws IOException {
+ final int b = super.read();
+ if (b > -1) {
+ uncompressedCount++;
+ }
+ return b;
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ final int bytes = super.read(b, off, len);
+ if (bytes > -1) {
+ uncompressedCount += bytes;
+ }
+ return bytes;
+ }
+
+ @Override
+ public long getCompressedCount() {
+ return compressedCount;
+ }
+
+ @Override
+ public long getUncompressedCount() {
+ return uncompressedCount;
+ }
+}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/446555b1/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 5e7cfa0..6beedcb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -502,7 +502,7 @@ public class ZipFile implements Closeable {
// and has been fixed a long time ago, but the contract persists so
// we comply.
// https://docs.oracle.com/javase/7/docs/api/java/util/zip/Inflater.html#Inflater(boolean)
- return new InflaterInputStream(new SequenceInputStream(is, new ByteArrayInputStream(ONE_ZERO_BYTE)),
+ return new InflaterInputStreamWithStatistics(new SequenceInputStream(is, new ByteArrayInputStream(ONE_ZERO_BYTE)),
inflater) {
@Override
public void close() throws IOException {