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 8f7749d Trade this for underscores in constructor. 8f7749d is described below commit 8f7749de40c1cf91be9e8fc835535b067c53a2dd Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 26 12:07:50 2021 -0500 Trade this for underscores in constructor. Better internal name. --- .../archivers/zip/ZipArchiveInputStream.java | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java index 1d25372..b84c2f2 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java @@ -90,7 +90,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt private final boolean useUnicodeExtraFields; /** Wrapped stream, will always be a PushbackInputStream. */ - private final InputStream in; + private final InputStream inputStream; /** Inflater used for all deflated entries. */ private final Inflater inf = new Inflater(true); @@ -247,13 +247,12 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt final String encoding, final boolean useUnicodeExtraFields, final boolean allowStoredEntriesWithDataDescriptor, - final boolean skipSplitSig) { + final boolean skipSplitSig) { this.encoding = encoding; zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); this.useUnicodeExtraFields = useUnicodeExtraFields; - in = new PushbackInputStream(inputStream, buf.capacity()); - this.allowStoredEntriesWithDataDescriptor = - allowStoredEntriesWithDataDescriptor; + this.inputStream = new PushbackInputStream(inputStream, buf.capacity()); + this.allowStoredEntriesWithDataDescriptor = allowStoredEntriesWithDataDescriptor; this.skipSplitSig = skipSplitSig; // haven't read anything so far buf.limit(0); @@ -367,7 +366,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt final ZipMethod m = ZipMethod.getMethodByCode(current.entry.getMethod()); if (current.entry.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN) { if (ZipUtil.canHandleEntryData(current.entry) && m != ZipMethod.STORED && m != ZipMethod.DEFLATED) { - final InputStream bis = new BoundedInputStream(in, current.entry.getCompressedSize()); + final InputStream bis = new BoundedInputStream(inputStream, current.entry.getCompressedSize()); switch (m) { case UNSHRINKING: current.in = new UnshrinkingInputStream(bis); @@ -396,7 +395,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt } } } else if (m == ZipMethod.ENHANCED_DEFLATED) { - current.in = new Deflate64CompressorInputStream(in); + current.in = new Deflate64CompressorInputStream(inputStream); } entriesRead++; @@ -597,7 +596,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt if (buf.position() >= buf.limit()) { buf.position(0); - final int l = in.read(buf.array()); + final int l = inputStream.read(buf.array()); if (l == -1) { buf.limit(0); throw new IOException("Truncated ZIP file"); @@ -670,7 +669,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt if (!closed) { closed = true; try { - in.close(); + inputStream.close(); } finally { inf.end(); } @@ -819,7 +818,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt private void drainCurrentEntryData() throws IOException { long remaining = current.entry.getCompressedSize() - current.bytesReadFromStream; while (remaining > 0) { - final long n = in.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining)); + final long n = inputStream.read(buf.array(), 0, (int) Math.min(buf.capacity(), remaining)); if (n < 0) { throw new EOFException("Truncated ZIP entry: " + ArchiveUtils.sanitize(current.entry.getName())); @@ -858,7 +857,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt if (closed) { throw new IOException("The stream is closed"); } - final int length = in.read(buf.array()); + final int length = inputStream.read(buf.array()); if (length > 0) { buf.limit(length); count(buf.limit()); @@ -873,7 +872,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt private void readFully(final byte[] b, final int off) throws IOException { final int len = b.length - off; - final int count = IOUtils.readFully(in, b, off, len); + final int count = IOUtils.readFully(inputStream, b, off, len); count(count); if (count < len) { throw new EOFException(); @@ -881,7 +880,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt } private byte[] readRange(int len) throws IOException { - final byte[] ret = IOUtils.readRange(in, len); + final byte[] ret = IOUtils.readRange(inputStream, len); count(ret.length); if (ret.length < len) { throw new EOFException(); @@ -998,7 +997,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt final int ddLen = current.usesZip64 ? WORD + 2 * DWORD : 3 * WORD; while (!done) { - final int r = in.read(buf.array(), off, ZipArchiveOutputStream.BUFFER_SIZE - off); + final int r = inputStream.read(buf.array(), off, ZipArchiveOutputStream.BUFFER_SIZE - off); if (r <= 0) { // read the whole archive without ever finding a // central directory @@ -1093,7 +1092,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt } private void pushback(final byte[] buf, final int offset, final int length) throws IOException { - ((PushbackInputStream) in).unread(buf, offset, length); + ((PushbackInputStream) inputStream).unread(buf, offset, length); pushedBackBytes(length); } @@ -1191,7 +1190,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt long skipped = 0; while (skipped < value) { final long rem = value - skipped; - final int x = in.read(skipBuf, 0, (int) (skipBuf.length > rem ? rem : skipBuf.length)); + final int x = inputStream.read(skipBuf, 0, (int) (skipBuf.length > rem ? rem : skipBuf.length)); if (x == -1) { return; } @@ -1210,7 +1209,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt * Also updates bytes-read counter. */ private int readOneByte() throws IOException { - final int b = in.read(); + final int b = inputStream.read(); if (b != -1) { count(1); }