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/12/08 01:53:05 UTC

[GitHub] [commons-compress] garydgregory commented on a diff in pull request #334: COMPRESS-621: Fix calculation the offset of the first zip central directory entry

garydgregory commented on code in PR #334:
URL: https://github.com/apache/commons-compress/pull/334#discussion_r1042844713


##########
src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:
##########
@@ -720,6 +721,28 @@ public String getUnixSymlink(final ZipArchiveEntry entry) throws IOException {
         return null;
     }
 
+    /**
+     * Offset of the first local file header in the file.
+     *
+     * @return the length of the content before the first local file header
+     * @since 1.23
+     */
+    public long getFirstLocalFileHeaderOffset() {
+        return firstLocalFileHeaderOffset;
+    }
+
+    /**
+     * Returns an InputStream for reading the content before the first local file header.
+     *
+     * @return null if there is no content before the first local file header.
+     * Otherwise returns a stream to read the content before the first local file header.
+     * @since 1.23
+     */
+    public InputStream getContentBeforeFirstLocalFileHeader() {

Review Comment:
   See above.



##########
src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:
##########
@@ -163,6 +163,7 @@ public class ZipFile implements Closeable {
 
     private long centralDirectoryStartDiskNumber, centralDirectoryStartRelativeOffset;
     private long centralDirectoryStartOffset;
+    private long firstLocalFileHeaderOffset = 0L;

Review Comment:
   No need to initialize to default value.



##########
src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java:
##########
@@ -720,6 +721,28 @@ public String getUnixSymlink(final ZipArchiveEntry entry) throws IOException {
         return null;
     }
 
+    /**
+     * Offset of the first local file header in the file.

Review Comment:
   Javadoc for getters should start with "Gets..."



-- 
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