Package com.e1c.g5.v8.internal.fastzip
Class ParallelFzipReader
java.lang.Object
com.e1c.g5.v8.internal.fastzip.ParallelFzipReader
- All Implemented Interfaces:
IFzipReader,Closeable,AutoCloseable
Implementation of
IFzipReader, which supports parallel decompression.-
Constructor Summary
ConstructorsConstructorDescriptionParallelFzipReader(Path archPath, IFzipEntryRegistry registry, int numWorkers, boolean memoryMapped) Constructs a new parallel FastZIP reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intGets the number of entries contained in the archive.entries()Gets a stream of entry descriptors contained in the archive.voidread()Restores all entries from the archive.voidsetProgressListener(IProgressListener progressListener) Sets a progress listener.
-
Constructor Details
-
ParallelFzipReader
public ParallelFzipReader(Path archPath, IFzipEntryRegistry registry, int numWorkers, boolean memoryMapped) throws IOException Constructs a new parallel FastZIP reader.- Parameters:
archPath- the path to the FastZIP archive, cannot benullregistry- the FastZIP entry registry, cannot benullnumWorkers- number of threads to be used for decompression, must be positivememoryMapped- whether memory mapped IO shall be used- Throws:
IOException- if the file could not be opened
-
-
Method Details
-
setProgressListener
Description copied from interface:IFzipReaderSets a progress listener. The listener is used to track progress ofIFzipReader.read()operation.- Specified by:
setProgressListenerin interfaceIFzipReader- Parameters:
progressListener- the progress listener, ornullto remove a previously set listener
-
read
Description copied from interface:IFzipReaderRestores all entries from the archive. Reports the progress to a progress listener if it was set. The order in which the entries are restored is not specified.If the operation fails the reader might end up in a closed state and no guarantees on which entries were fully or partially read are provided.
- Specified by:
readin interfaceIFzipReader- Throws:
FzipException- if the source file is not a FastZIP archive, the archive is corrupted or written with incompatible registryIOException- if an IO error occurs
-
countEntries
Description copied from interface:IFzipReaderGets the number of entries contained in the archive.- Specified by:
countEntriesin interfaceIFzipReader- Returns:
- the number of entries
- Throws:
FzipException- if the source file is not a FastZIP archive, the archive is corrupted or written with incompatible registryIOException- if an IO error occurs
-
entries
Description copied from interface:IFzipReaderGets a stream of entry descriptors contained in the archive. This method does not restore the entry contents.- Specified by:
entriesin interfaceIFzipReader- Returns:
- the stream of FastZIP entries, never
null - Throws:
FzipException- if the source file is not a FastZIP archive, the archive is corrupted or written with incompatible registryIOException- if an IO error occurs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-