Class ConcurrentJarCreator

java.lang.Object
org.codehaus.plexus.archiver.zip.ConcurrentJarCreator

public class ConcurrentJarCreator extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
     
    private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream
     
    private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream
     
    private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream
     
    private final org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator
     
    private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream
     
    private long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConcurrentJarCreator(boolean compressAddedZips, int nThreads)
    Creates a new ConcurrentJarCreator instance.
    ConcurrentJarCreator(int nThreads)
    Creates a new ConcurrentJarCreator instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier source, boolean addInParallel)
    Adds an archive entry to this archive.
    static org.apache.commons.compress.archivers.zip.ScatterZipOutputStream
    createDeferred(org.apache.commons.compress.parallel.ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier)
     
    private org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequest
    createEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier inputStreamSupplier)
     
    Returns a message describing the overall statistics of the compression run
    private boolean
    isZipHeader(byte[] header)
     
    private org.apache.commons.compress.parallel.InputStreamSupplier
    prependBytesToStream(byte[] bytes, int len, InputStream stream)
     
    void
    writeTo(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream targetStream)
     

    Methods inherited from class java.lang.Object

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

    • compressAddedZips

      private final boolean compressAddedZips
    • metaInfDir

      private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream metaInfDir
    • manifest

      private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream manifest
    • directories

      private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream directories
    • synchronousEntries

      private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream synchronousEntries
    • parallelScatterZipCreator

      private final org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator parallelScatterZipCreator
    • zipCloseElapsed

      private long zipCloseElapsed
  • Constructor Details

    • ConcurrentJarCreator

      public ConcurrentJarCreator(int nThreads) throws IOException
      Creates a new ConcurrentJarCreator instance.

      ConcurrentJarCreator creates zip files using several concurrent threads.

      This constructor has the same effect as ConcurrentJarCreator(true, nThreads)

      Parameters:
      nThreads - The number of concurrent thread used to create the archive
      Throws:
      IOException
    • ConcurrentJarCreator

      public ConcurrentJarCreator(boolean compressAddedZips, int nThreads) throws IOException
      Creates a new ConcurrentJarCreator instance.

      ConcurrentJarCreator creates zip files using several concurrent threads. Entries that are already zip file could be just stored or compressed again.

      Parameters:
      compressAddedZips - Indicates if entries that are zip files should be compressed. If set to false entries that are zip files will be added using ZipEntry.STORED method. If set to true entries that are zip files will be added using the compression method indicated by the ZipArchiveEntry passed to addArchiveEntry(ZipArchiveEntry, InputStreamSupplier, boolean). The compression method for all entries that are not zip files will not be changed regardless of the value of this parameter
      nThreads - The number of concurrent thread used to create the archive
      Throws:
      IOException
  • Method Details

    • createDeferred

      public static org.apache.commons.compress.archivers.zip.ScatterZipOutputStream createDeferred(org.apache.commons.compress.parallel.ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier) throws IOException
      Throws:
      IOException
    • addArchiveEntry

      public void addArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier source, boolean addInParallel) throws IOException
      Adds an archive entry to this archive.

      This method is expected to be called from a single client thread

      Parameters:
      zipArchiveEntry - The entry to add. Compression method
      source - The source input stream supplier
      addInParallel - Indicates if the entry should be add in parallel. If set to false the entry is added synchronously.
      Throws:
      IOException
    • writeTo

      public void writeTo(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream targetStream) throws IOException, ExecutionException, InterruptedException
      Throws:
      IOException
      ExecutionException
      InterruptedException
    • getStatisticsMessage

      public String getStatisticsMessage()
      Returns a message describing the overall statistics of the compression run
      Returns:
      A string
    • createEntry

      private org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequest createEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier inputStreamSupplier)
    • isZipHeader

      private boolean isZipHeader(byte[] header)
    • prependBytesToStream

      private org.apache.commons.compress.parallel.InputStreamSupplier prependBytesToStream(byte[] bytes, int len, InputStream stream)