Class ParallelFzipReader

java.lang.Object
com.e1c.g5.v8.internal.fastzip.ParallelFzipReader
All Implemented Interfaces:
IFzipReader, Closeable, AutoCloseable

public class ParallelFzipReader extends Object implements IFzipReader
Implementation of IFzipReader, which supports parallel decompression.
  • 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 be null
      registry - the FastZIP entry registry, cannot be null
      numWorkers - number of threads to be used for decompression, must be positive
      memoryMapped - whether memory mapped IO shall be used
      Throws:
      IOException - if the file could not be opened
  • Method Details

    • setProgressListener

      public void setProgressListener(IProgressListener progressListener)
      Description copied from interface: IFzipReader
      Sets a progress listener. The listener is used to track progress of IFzipReader.read() operation.
      Specified by:
      setProgressListener in interface IFzipReader
      Parameters:
      progressListener - the progress listener, or null to remove a previously set listener
    • read

      public void read() throws IOException
      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 interface IFzipReader
      Throws:
      FzipException - if the source file is not a FastZIP archive, the archive is corrupted or written with incompatible registry
      IOException - if an IO error occurs
    • countEntries

      public int countEntries() throws IOException
      Description copied from interface: IFzipReader
      Gets the number of entries contained in the archive.
      Specified by:
      countEntries in interface IFzipReader
      Returns:
      the number of entries
      Throws:
      FzipException - if the source file is not a FastZIP archive, the archive is corrupted or written with incompatible registry
      IOException - if an IO error occurs
    • entries

      public Stream<IFzipEntry> entries() throws IOException
      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 interface IFzipReader
      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 registry
      IOException - if an IO error occurs
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException