Package com.e1c.g5.v8.internal.fastzip
Class ParallelFzipWriter
java.lang.Object
com.e1c.g5.v8.internal.fastzip.ParallelFzipWriter
- All Implemented Interfaces:
IFzipWriter,Closeable,AutoCloseable
Implementation of
IFzipWriter, which supports parallel compression.-
Constructor Summary
ConstructorsConstructorDescriptionParallelFzipWriter(Path archPath, IFzipEntryRegistry registry, int chunkSize, int numWorkers, boolean memoryMapped, int level) Constructs a new parallel FastZIP writer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidsetProgressListener(IProgressListener progressListener) Sets a progress listener.voidwrite(IFzipEntry[] entries) Writes entries to the archive.
-
Constructor Details
-
ParallelFzipWriter
public ParallelFzipWriter(Path archPath, IFzipEntryRegistry registry, int chunkSize, int numWorkers, boolean memoryMapped, int level) throws IOException Constructs a new parallel FastZIP writer.- Parameters:
archPath- the path to the FastZIP archive, if the file already exists it will be overwritten, cannot benullregistry- the FastZIP entry registry, cannot benullchunkSize- chunk size in bytes, seecom.e1c.g5.v8.fastzipnumWorkers- number of threads to be used for compression, must be positivememoryMapped- whether memory mapped IO shall be usedlevel- Zstandard compression level- Throws:
IOException- if the file could not be opened
-
-
Method Details
-
setProgressListener
Description copied from interface:IFzipWriterSets a progress listener. The listener is used to track progress ofIFzipWriter.write(IFzipEntry[])operation.- Specified by:
setProgressListenerin interfaceIFzipWriter- Parameters:
progressListener- the progress listener, ornullto remove a previously set listener
-
write
Description copied from interface:IFzipWriterWrites entries to the archive. The entries must belong to the registry of this writer. Reports the progress to a progress listener if it was set.If the operation fails the writer might end up in a closed state and no guarantees on the contents and consistency of the archive are provided.
- Specified by:
writein interfaceIFzipWriter- Parameters:
entries- the entries, cannot benull, cannot containnullvalues- Throws:
FzipException- if the writer failed to compress the entries for any reasonIOException- if an IO error occurs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-