Package com.mku.fs.drive.utils
Class FileImporter
java.lang.Object
com.mku.fs.drive.utils.FileImporter
- Direct Known Subclasses:
AesFileImporter
Import IFile(s) into a VirtualDrive.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFile importer options -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the current importprotected abstract longGet the minimum part of file that can be imported in parallel.importFile(IFile fileToImport, IVirtualFile dir) Imports a real file into the drive.importFile(IFile fileToImport, IVirtualFile dir, FileImporter.FileImportOptions options) Imports a real file into the drive.voidinitialize(int bufferSize, int threads) Constructs a file importer that can be used to import files into the drivebooleanCheck if importer is currently running a job.protected abstract voidonPrepare(IVirtualFile targetFile, boolean integrity) Runs before importvoidstop()Stops all current importing tasks
-
Constructor Details
-
FileImporter
public FileImporter()
-
-
Method Details
-
onPrepare
Runs before import- Parameters:
targetFile- The target file importedintegrity- If integrity verification is enabled- Throws:
IOException- If there is a problem with the file preparation.
-
getMinimumPartSize
Get the minimum part of file that can be imported 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) Constructs a file importer that can be used to import files into 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()Check if importer is currently running a job.- Returns:
- True if running
-
importFile
Imports a real file into the drive.- Parameters:
fileToImport- The source file that will be imported in into the drive.dir- The target directory in the drive that the file will be imported- Returns:
- The imported file
- Throws:
Exception- Thrown if error occurs during import
-
importFile
public IVirtualFile importFile(IFile fileToImport, IVirtualFile dir, FileImporter.FileImportOptions options) throws Exception Imports a real file into the drive.- Parameters:
fileToImport- The source file that will be imported in into the drive.dir- The target directory in the drive that the file will be importedoptions- The options- Returns:
- The imported file
- Throws:
Exception- Thrown if error occurs during import
-
close
public void close()Stops the current import
-