Class ParallelZipCopyAction

java.lang.Object
com.ljarocki.parallelzip.internal.ParallelZipCopyAction
All Implemented Interfaces:
org.gradle.api.internal.file.copy.CopyAction

public final class ParallelZipCopyAction extends Object implements org.gradle.api.internal.file.copy.CopyAction
Bridges Gradle's copy pipeline to ParallelZipWriter. Gradle resolves the whole CopySpec (all from/into/include/exclude/ rename/filter, plus duplicate handling and reproducible ordering via its decorators) and streams the final files here; we hand each off to the parallel writer, so the archive is built across all cores.

An entry with no content filter/transform configured is handed off as a reference to its real source file, read lazily on a worker thread at compress time -- same as the streamed/ spilled path already does. This is safe because Gradle's own FileCopyDetails only exposes the real file when no filter is present: getFile() and open() share the identical guard, so whenever getFile() doesn't throw, it returns exactly the bytes open() would have. A filtered entry's content is a transformed stream, not a real file, so it's still consumed on this (single-threaded) stream iteration -- Gradle's filter chain has to run through its own API. Small entries are buffered in memory; entries over the spill threshold are copied to a temp file. Backpressure from the ParallelZipWriter.Sink bounds how many entries are materialized/queued at once.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ParallelZipCopyAction(Path archive, boolean store, boolean skipAlreadyCompressed, int level, int threads, boolean preserveTimestamps, long spillThreshold)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.gradle.api.tasks.WorkResult
    execute(org.gradle.api.internal.file.copy.CopyActionProcessingStream stream)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ParallelZipCopyAction

      public ParallelZipCopyAction(Path archive, boolean store, boolean skipAlreadyCompressed, int level, int threads, boolean preserveTimestamps, long spillThreshold)
  • Method Details

    • execute

      public org.gradle.api.tasks.WorkResult execute(org.gradle.api.internal.file.copy.CopyActionProcessingStream stream)
      Specified by:
      execute in interface org.gradle.api.internal.file.copy.CopyAction