Class ConcurrentFileExtractor

java.lang.Object
electrostatic4j.snaploader.filesystem.FileExtractor
electrostatic4j.snaploader.filesystem.ConcurrentFileExtractor
All Implemented Interfaces:
OutputStreamProvider, StreamProvider, AutoCloseable
Direct Known Subclasses:
LibraryExtractor

public class ConcurrentFileExtractor extends FileExtractor
A thread-safe implementation of the filesystem extractor API.
  • Field Details

    • lock

      protected final ReentrantLock lock
      An Object that controls the monitor.
  • Constructor Details

    • ConcurrentFileExtractor

      public ConcurrentFileExtractor(FileLocator fileLocator, String destination)
      Instantiates a thread-safe filesystem extractor instance.
      Parameters:
      fileLocator - locates a filesystem inside a zip compression
      destination - an absolute filesystem path representing the extraction destination filesystem
    • ConcurrentFileExtractor

      protected ConcurrentFileExtractor()
      Instantiates an empty filesystem extractor instance.
  • Method Details

    • extract

      public void extract() throws IOException
      Description copied from class: FileExtractor
      Commands and Extract the specified filesystem to the specified destination filesystem.

      Warning: this function leaks buffered streams; this vision was attained for freedom of use, but the user application must keep in mind that stream closure and resources release must be attained either through the extraction completed and failure listeners, or through a try-with resources.

      Overrides:
      extract in class FileExtractor
      Throws:
      IOException - if the input/output streams has failed or an interrupted I/O operation has occurred.
      FileNotFoundException - if the file locator has failed to locate the file inside the compression for the extraction process.