commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kvr000 <...@git.apache.org>
Subject [GitHub] commons-compress pull request #21: COMPRESS-388: Fix concurrent reads perfor...
Date Sun, 23 Apr 2017 16:30:47 GMT
Github user kvr000 commented on a diff in the pull request:

    https://github.com/apache/commons-compress/pull/21#discussion_r112838711
  
    --- Diff: src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java ---
    @@ -1081,16 +1082,26 @@ private boolean startsWithLocalFileHeader() throws IOException
{
         }
     
         /**
    +     * Creates new BoundedInputStream, according to implementation of
    +     * underlying archive channel.
    +     */
    +    private BoundedInputStream createBoundedInputStream(long start, long remaining) {
    +        return archive instanceof FileChannel ?
    +            new BoundedFileChannelInputStream(start, remaining) :
    +            new BoundedInputStream(start, remaining);
    +    }
    +
    +    /**
          * InputStream that delegates requests to the underlying
          * SeekableByteChannel, making sure that only bytes from a certain
          * range can be read.
          */
         private class BoundedInputStream extends InputStream {
    -        private static final int MAX_BUF_LEN = 8192;
    -        private final ByteBuffer buffer;
    -        private long remaining;
    -        private long loc;
    -        private boolean addDummyByte = false;
    +        protected static final int MAX_BUF_LEN = 8192;
    +        protected final ByteBuffer buffer;
    +        protected long remaining;
    +        protected long loc;
    +        protected boolean addDummyByte = false;
     
    --- End diff --
    
    They can be package protected too, it's in private class anyway. The fields are accessed
by the FileChannel specialization so private won't suffice.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message