[
https://issues.apache.org/jira/browse/COMPRESS-621?focusedWorklogId=831930&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-831930
]
ASF GitHub Bot logged work on COMPRESS-621:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 08/Dec/22 01:53
Start Date: 08/Dec/22 01:53
Worklog Time Spent: 10m
Work Description: 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..."
Issue Time Tracking
-------------------
Worklog Id: (was: 831930)
Time Spent: 40m (was: 0.5h)
> ZipFile does not support prepending additional data to the zip content
> ----------------------------------------------------------------------
>
> Key: COMPRESS-621
> URL: https://issues.apache.org/jira/browse/COMPRESS-621
> Project: Commons Compress
> Issue Type: Bug
> Components: Archivers
> Affects Versions: 1.21
> Reporter: Glavo
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> In general, Zip files support placing arbitrary content before their body
> without affecting their compliance.
> Here is an example:
> [https://github.com/huanghongxun/HMCL/releases/download/v3.5.2.218/HMCL-3.5.2.218.exe]
>
> This is actually a jar file, but we prepend an exe launcher to it, so it can
> be used both as a jar and as an exe.
> java.util.zip.ZipFile can open and read it normally, but
> org.apache.commons.compress.archivers.zip.ZipFile can open it but cannot read
> any entries.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)