You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/08/13 07:21:39 UTC

[GitHub] [commons-compress] dweiss commented on a diff in pull request #306: COMPRESS-623: make ZipFile's getRawInputStream usable when local headers are not read

dweiss commented on code in PR #306:
URL: https://github.com/apache/commons-compress/pull/306#discussion_r944327197


##########
src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:
##########
@@ -638,13 +646,11 @@ public InputStream getInputStream(final ZipArchiveEntry ze)
         }
         // cast validity is checked just above
         ZipUtil.checkRequestedFeatures(ze);
-        final long start = getDataOffset(ze);
 
         // doesn't get closed if the method is not supported - which
         // should never happen because of the checkRequestedFeatures
         // call above
-        final InputStream is =
-            new BufferedInputStream(createBoundedInputStream(start, ze.getCompressedSize())); //NOSONAR
+        final InputStream is = new BufferedInputStream(getRawInputStream(ze)); //NOSONAR
         switch (ZipMethod.getMethodByCode(ze.getMethod())) {

Review Comment:
   This replaces duplicate code by just requesting a raw compressed stream, which should be always available.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org