Class FileExporter

java.lang.Object
com.mku.fs.drive.utils.FileExporter
Direct Known Subclasses:
AesFileExporter

public abstract class FileExporter extends Object
Exports IVirtualFile(s) from a VirtualDrive.
  • Constructor Details

    • FileExporter

      public FileExporter()
  • Method Details

    • onPrepare

      protected abstract void onPrepare(IVirtualFile sourceFile, boolean integrity) throws IOException
      Runs before export
      Parameters:
      sourceFile - The file that will be imported
      integrity - If integrity verification is enabled
      Throws:
      IOException - If there is a problem with the file preparation.
    • getMinimumPartSize

      protected abstract long getMinimumPartSize(IVirtualFile file) throws IOException
      Get the minimum part of file that can be exported in parallel.
      Parameters:
      file - The file
      Returns:
      The number of bytes
      Throws:
      IOException - If there was a problem calculating the size.
    • initialize

      public void initialize(int bufferSize, int threads)
      Initialize the exporter.
      Parameters:
      bufferSize - The buffer size to use while exporting
      threads - The number of parallel threads to run
    • isRunning

      public boolean isRunning()
      Check if export is running
      Returns:
      True if running
    • stop

      public void stop()
      Stop current export
    • exportFile

      public IFile exportFile(IVirtualFile fileToExport, IFile exportDir) throws Exception
      Export a file from the drive to the external directory path
      Parameters:
      fileToExport - The file that will be exported
      exportDir - The external directory the file will be exported to
      Returns:
      The exported file
      Throws:
      Exception - Thrown if error occurs during export
    • exportFile

      public IFile exportFile(IVirtualFile fileToExport, IFile exportDir, FileExporter.FileExportOptions options) throws Exception
      Export a file from the drive to the external directory path
      Parameters:
      fileToExport - The file that will be exported
      exportDir - The external directory the file will be exported to
      options - The options
      Returns:
      The exported file
      Throws:
      Exception - Thrown if error occurs during export
    • close

      public void close()
      Close exporter and release resources.