11package software .coley .lljzip .format .model ;
22
3+ import software .coley .lljzip .format .read .ZipReader ;
34import software .coley .lljzip .format .transform .ZipPartMapper ;
45import software .coley .lljzip .util .OffsetComparator ;
56
67import javax .annotation .Nonnull ;
78import javax .annotation .Nullable ;
89import java .io .Closeable ;
910import java .io .IOException ;
11+ import java .lang .foreign .MemorySegment ;
1012import java .util .*;
1113import java .util .function .Predicate ;
1214import java .util .stream .Collectors ;
1921public class ZipArchive implements AutoCloseable , Iterable <ZipPart > {
2022 private final List <ZipPart > parts = new ArrayList <>();
2123 private final Closeable closableBackingResource ;
24+ private MemorySegment prefixData ;
2225
2326 /**
2427 * New zip archive without any backing resource.
@@ -37,6 +40,28 @@ public ZipArchive(@Nonnull Closeable closableBackingResource) {
3740 this .closableBackingResource = closableBackingResource ;
3841 }
3942
43+ /**
44+ * If the {@link ZipReader} used to read this archive supports tracking such information this will return
45+ * any data not contained in the archive that was found at the front of the input content.
46+ * <p/>
47+ * Some applications like Jar2Exe will prepend a loader executable in front of the jar, in which case this content
48+ * would be that executable. It can be any kind of arbitrary data though.
49+ *
50+ * @return Data at the front of the archive.
51+ */
52+ @ Nullable
53+ public MemorySegment getPrefixData () {
54+ return prefixData ;
55+ }
56+
57+ /**
58+ * @param prefixData
59+ * Data at the front of the archive.
60+ */
61+ public void setPrefixData (@ Nullable MemorySegment prefixData ) {
62+ this .prefixData = prefixData ;
63+ }
64+
4065 /**
4166 * @param mapper
4267 * Part mapper to manipulate contained zip parts.
0 commit comments