Class FzipIOFactory

java.lang.Object
com.e1c.g5.v8.fastzip.FzipIOFactory

public class FzipIOFactory extends Object
A factory for obtaining FastZIP readers and writers with specific properties.
See Also:
  • Constructor Details

    • FzipIOFactory

      public FzipIOFactory(boolean mmapped, int numThreads, int chunkSize)
      Constructs a new factory.
      Parameters:
      mmapped - whether memory mapped IO shall be used to write and read archives
      numThreads - number of threads to be used for compression and decompression, must be positive
      chunkSize - size of archive chunk in bytes, must be positive, values less than 4K are strongly discouraged
      Throws:
      IllegalArgumentException - if argument constraints are not satisfied
    • FzipIOFactory

      public FzipIOFactory(boolean mmapped, int numThreads)
      Constructs a new factory with default chunk size.
      Parameters:
      mmapped - whether memory mapped IO shall be used to write and read archives
      numThreads - number of threads to be used for compression and decompression, must be positive
      Throws:
      IllegalArgumentException - if argument constraints are not satisfied
  • Method Details

    • openReader

      public IFzipReader openReader(Path archPath, IFzipEntryRegistry registry) throws IOException
      Creates a new FastZIP reader.

      The file archPath is required to exist and be a FastZIP archive, created with a compatible registry.

      The returned implementation is not thread-safe.

      Parameters:
      archPath - the path to the archive, cannot be null
      registry - the FastZIP entry registry, cannot be null
      Returns:
      the reader, never null
      Throws:
      IOException - if an IO error occurs
    • openWriter

      public IFzipWriter openWriter(Path archPath, IFzipEntryRegistry registry) throws IOException
      Creates a new FastZIP writer.

      If the file archPath already exists, it will be overwritten.

      The returned implementation is not thread-safe.

      Parameters:
      archPath - the path to the archive, cannot be null
      registry - the FastZIP entry registry, cannot be null
      Returns:
      the writer, never null
      Throws:
      IOException - if an IO error occurs