Package com.mku.utils

Class FileImporter

java.lang.Object
com.mku.utils.FileImporter
Direct Known Subclasses:
SalmonFileImporter

public abstract class FileImporter extends Object
  • Constructor Details

    • FileImporter

      public FileImporter()
  • Method Details

    • onPrepare

      protected abstract void onPrepare(IVirtualFile importedFile, boolean integrity) throws IOException
      Throws:
      IOException
    • getMinimumPartSize

      protected abstract long getMinimumPartSize(IVirtualFile file) throws IOException
      Throws:
      IOException
    • initialize

      public void initialize(int bufferSize, int threads)
      Constructs a file importer that can be used to import files to the drive
      Parameters:
      bufferSize - Buffer size to be used when encrypting files. If using integrity this value has to be a multiple of the Chunk size. If not using integrity it should be a multiple of the AES block size for better performance
      threads - The threads to use for import
    • stop

      public void stop()
      Stops all current importing tasks
    • isRunning

      public boolean isRunning()
      True if importer is currently running a job.
      Returns:
      True if running
    • importFile

      public IVirtualFile importFile(IRealFile fileToImport, IVirtualFile dir, String filename, boolean deleteSource, boolean integrity, BiConsumer<Long,Long> onProgress) throws Exception
      Imports a real file into the drive.
      Parameters:
      fileToImport - The source file that will be imported in to the drive.
      dir - The target directory in the drive that the file will be imported
      filename - The filename to use
      deleteSource - If true delete the source file.
      integrity - Apply data integrity
      onProgress - Progress to notify
      Returns:
      The imported file
      Throws:
      Exception - Thrown if error occurs during import
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()