Package com.mku.utils
Class FileImporter
java.lang.Object
com.mku.utils.FileImporter
- Direct Known Subclasses:
SalmonFileImporter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidfinalize()protected abstract longimportFile(IRealFile fileToImport, IVirtualFile dir, String filename, boolean deleteSource, boolean integrity, BiConsumer<Long, Long> onProgress) Imports a real file into the drive.voidinitialize(int bufferSize, int threads) Constructs a file importer that can be used to import files to the drivebooleanTrue if importer is currently running a job.protected abstract voidonPrepare(IVirtualFile importedFile, boolean integrity) voidstop()Stops all current importing tasks
-
Constructor Details
-
FileImporter
public FileImporter()
-
-
Method Details
-
onPrepare
- Throws:
IOException
-
getMinimumPartSize
- 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 performancethreads- 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 ExceptionImports 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 importedfilename- The filename to usedeleteSource- If true delete the source file.integrity- Apply data integrityonProgress- Progress to notify- Returns:
- The imported file
- Throws:
Exception- Thrown if error occurs during import
-
finalize
protected void finalize() -
close
public void close()
-