Class ParallelZipWriter
write(java.util.List<com.ljarocki.parallelzip.internal.ParallelZipWriter.Source>, java.nio.file.Path, boolean, int, int, boolean)) and the Gradle CopyAction feed it a list of ParallelZipWriter.Entry.
Pipeline: every entry is compressed (STORE or DEFLATE) on a worker pool, while a single writer thread drains results in the given list order and streams them to the archive. Parallelism never affects the byte layout, so output is deterministic regardless of thread count. With fixed timestamps the archive is byte-for-byte reproducible across rebuilds of identical content.
Small entries are compressed in memory; entries larger than SPILL_THRESHOLD are
mapped straight from the source file into the native accelerator (see
MMAP_THRESHOLD) when one is available, or otherwise streamed through the JDK
deflater to a temp file, so a single entry may be arbitrarily large either way. ZIP64 is
emitted automatically for archives > 4 GiB, more than 65,535 entries, or per-entry
sizes/offsets beyond 4 GiB.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne archive entry.static final recordstatic final classA running compress-and-write pipeline.static final recordA source tree to be added under an optional archive path prefix (directory front-end). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longEntries larger than this are streamed (spilled) instead of held in memory. -
Method Summary
Modifier and TypeMethodDescriptionstatic ParallelZipWriter.Entrystatic int[]dosDateTime(long millis) static ParallelZipWriter.EntryfileEntry(String name, Path file, boolean fileIsTemp, long size, int dosTime, int dosDate, int externalAttr) static ParallelZipWriter.EntryinlineEntry(String name, byte[] data, int dosTime, int dosDate, int externalAttr) static ParallelZipWriter.Resultwrite(List<ParallelZipWriter.Source> sources, Path out, boolean store, int level, int threads, boolean preserveTimestamps) Directory front-end: walk source trees and archive them.static ParallelZipWriter.ResultwriteEntries(List<ParallelZipWriter.Entry> entries, Path out, boolean store, boolean skipAlreadyCompressed, int level, int threads, boolean forceZip64, long spillThreshold, Path spillDir) static ParallelZipWriter.ResultwriteEntries(List<ParallelZipWriter.Entry> entries, Path out, boolean store, int level, int threads, boolean forceZip64, long spillThreshold, Path spillDir) Core: compressentriesin parallel and write them tooutin list order.
-
Field Details
-
SPILL_THRESHOLD
public static final long SPILL_THRESHOLDEntries larger than this are streamed (spilled) instead of held in memory.- See Also:
-
FIXED_DOS_TIME
public static final int FIXED_DOS_TIME- See Also:
-
FIXED_DOS_DATE
public static final int FIXED_DOS_DATE- See Also:
-
-
Method Details
-
dirEntry
public static ParallelZipWriter.Entry dirEntry(String name, int dosTime, int dosDate, int externalAttr) -
fileEntry
public static ParallelZipWriter.Entry fileEntry(String name, Path file, boolean fileIsTemp, long size, int dosTime, int dosDate, int externalAttr) -
inlineEntry
public static ParallelZipWriter.Entry inlineEntry(String name, byte[] data, int dosTime, int dosDate, int externalAttr) -
write
public static ParallelZipWriter.Result write(List<ParallelZipWriter.Source> sources, Path out, boolean store, int level, int threads, boolean preserveTimestamps) throws IOException, InterruptedException Directory front-end: walk source trees and archive them. Used by tests and the simple API.- Throws:
IOExceptionInterruptedException
-
writeEntries
public static ParallelZipWriter.Result writeEntries(List<ParallelZipWriter.Entry> entries, Path out, boolean store, int level, int threads, boolean forceZip64, long spillThreshold, Path spillDir) throws IOException, InterruptedException Core: compressentriesin parallel and write them tooutin list order. The caller ownsspillDir(creation and cleanup).- Throws:
IOExceptionInterruptedException
-
writeEntries
public static ParallelZipWriter.Result writeEntries(List<ParallelZipWriter.Entry> entries, Path out, boolean store, boolean skipAlreadyCompressed, int level, int threads, boolean forceZip64, long spillThreshold, Path spillDir) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
dosDateTime
public static int[] dosDateTime(long millis)
-