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 TypeMethodDescriptionvoid
close()
void
setProgressListener
(IProgressListener progressListener) Sets a progress listener.void
write
(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 benull
registry
- the FastZIP entry registry, cannot benull
chunkSize
- chunk size in bytes, seecom.e1c.g5.v8.fastzip
numWorkers
- 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:IFzipWriter
Sets a progress listener. The listener is used to track progress ofIFzipWriter.write(IFzipEntry[])
operation.- Specified by:
setProgressListener
in interfaceIFzipWriter
- Parameters:
progressListener
- the progress listener, ornull
to remove a previously set listener
-
write
Description copied from interface:IFzipWriter
Writes 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:
write
in interfaceIFzipWriter
- Parameters:
entries
- the entries, cannot benull
, cannot containnull
values- Throws:
FzipException
- if the writer failed to compress the entries for any reasonIOException
- if an IO error occurs
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-