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 TypeMethodDescriptionvoid
close()
int
Gets the number of entries contained in the archive.entries()
Gets a stream of entry descriptors contained in the archive.void
read()
Restores all entries from the archive.void
setProgressListener
(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 benull
registry
- the FastZIP entry registry, cannot benull
numWorkers
- 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:IFzipReader
Sets a progress listener. The listener is used to track progress ofIFzipReader.read()
operation.- Specified by:
setProgressListener
in interfaceIFzipReader
- Parameters:
progressListener
- the progress listener, ornull
to remove a previously set listener
-
read
Description copied from interface:IFzipReader
Restores 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:
read
in 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:IFzipReader
Gets the number of entries contained in the archive.- Specified by:
countEntries
in 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:IFzipReader
Gets a stream of entry descriptors contained in the archive. This method does not restore the entry contents.- Specified by:
entries
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-