Package com.mku.fs.drive.utils
Class FileImporter
- java.lang.Object
-
- com.mku.fs.drive.utils.FileImporter
-
- Direct Known Subclasses:
AesFileImporter
public abstract class FileImporter extends java.lang.ObjectImport IFile(s) into a VirtualDrive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileImporter.FileImportOptionsFile importer options
-
Constructor Summary
Constructors Constructor Description FileImporter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Stops the current importprotected abstract longgetMinimumPartSize(IVirtualFile file)Get the minimum part of file that can be imported in parallel.IVirtualFileimportFile(IFile fileToImport, IVirtualFile dir)Imports a real file into the drive.IVirtualFileimportFile(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 drivebooleanisRunning()Check if importer is currently running a job.protected abstract voidonPrepare(IVirtualFile targetFile, boolean integrity)Runs before importvoidstop()Stops all current importing tasks
-
-
-
Method Detail
-
onPrepare
protected abstract void onPrepare(IVirtualFile targetFile, boolean integrity) throws java.io.IOException
Runs before import- Parameters:
targetFile- The target file importedintegrity- If integrity verification is enabled- Throws:
java.io.IOException- If there is a problem with the file preparation.
-
getMinimumPartSize
protected abstract long getMinimumPartSize(IVirtualFile file) throws java.io.IOException
Get the minimum part of file that can be imported in parallel.- Parameters:
file- The file- Returns:
- The number of bytes
- Throws:
java.io.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
public IVirtualFile importFile(IFile fileToImport, IVirtualFile dir) throws java.lang.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 imported- Returns:
- The imported file
- Throws:
java.lang.Exception- Thrown if error occurs during import
-
importFile
public IVirtualFile importFile(IFile fileToImport, IVirtualFile dir, FileImporter.FileImportOptions options) throws java.lang.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:
java.lang.Exception- Thrown if error occurs during import
-
close
public void close()
Stops the current import
-
-