public class ConcurrentJarCreator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
ConcurrentJarCreator.DeferredSupplier |
Modifier and Type | Field and Description |
---|---|
private boolean |
compressAddedZips |
private org.apache.commons.compress.archivers.zip.ScatterZipOutputStream |
directories |
private org.apache.commons.compress.archivers.zip.ScatterZipOutputStream |
manifest |
private org.apache.commons.compress.archivers.zip.ScatterZipOutputStream |
metaInfDir |
private org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator |
parallelScatterZipCreator |
private org.apache.commons.compress.archivers.zip.ScatterZipOutputStream |
synchronousEntries |
private long |
zipCloseElapsed |
Constructor and Description |
---|
ConcurrentJarCreator(boolean compressAddedZips,
int nThreads)
Creates a new
ConcurrentJarCreator instance. |
ConcurrentJarCreator(int nThreads)
Creates a new
ConcurrentJarCreator instance. |
Modifier and Type | Method and 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) |
private org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequestSupplier |
createEntrySupplier(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry,
org.apache.commons.compress.parallel.InputStreamSupplier inputStreamSupplier) |
private org.apache.commons.compress.parallel.InputStreamSupplier |
createInputStreamSupplier(java.io.InputStream payload) |
java.lang.String |
getStatisticsMessage()
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,
java.io.InputStream stream) |
void |
writeTo(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream targetStream) |
private final boolean compressAddedZips
private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream directories
private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream metaInfDir
private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream manifest
private final org.apache.commons.compress.archivers.zip.ScatterZipOutputStream synchronousEntries
private final org.apache.commons.compress.archivers.zip.ParallelScatterZipCreator parallelScatterZipCreator
private long zipCloseElapsed
public ConcurrentJarCreator(int nThreads) throws java.io.IOException
ConcurrentJarCreator
instance.
ConcurrentJarCreator
creates zip files using several concurrent threads.
This constructor has the same effect as
ConcurrentJarCreator(true, nThreads)
nThreads
- The number of concurrent thread used to create the archivejava.io.IOException
public ConcurrentJarCreator(boolean compressAddedZips, int nThreads) throws java.io.IOException
ConcurrentJarCreator
instance.
ConcurrentJarCreator
creates zip files using several concurrent threads.
Entries that are already zip file could be just stored or compressed again.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 parameternThreads
- The number of concurrent thread used to create the archivejava.io.IOException
public static org.apache.commons.compress.archivers.zip.ScatterZipOutputStream createDeferred(org.apache.commons.compress.parallel.ScatterGatherBackingStoreSupplier scatterGatherBackingStoreSupplier) throws java.io.IOException
java.io.IOException
public void addArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier source, boolean addInParallel) throws java.io.IOException
zipArchiveEntry
- The entry to add. Compression methodsource
- The source input stream supplieraddInParallel
- Indicates if the entry should be add in parallel.
If set to false
the entry is added synchronously.java.io.IOException
private org.apache.commons.compress.parallel.InputStreamSupplier createInputStreamSupplier(java.io.InputStream payload)
public void writeTo(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream targetStream) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException
public java.lang.String getStatisticsMessage()
private org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequestSupplier createEntrySupplier(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier inputStreamSupplier)
private org.apache.commons.compress.archivers.zip.ZipArchiveEntryRequest createEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipArchiveEntry, org.apache.commons.compress.parallel.InputStreamSupplier inputStreamSupplier) throws java.io.IOException
java.io.IOException
private boolean isZipHeader(byte[] header)
private org.apache.commons.compress.parallel.InputStreamSupplier prependBytesToStream(byte[] bytes, int len, java.io.InputStream stream)