Package com.mku.fs.drive.utils
Class FileExporter
- java.lang.Object
-
- com.mku.fs.drive.utils.FileExporter
-
- Direct Known Subclasses:
AesFileExporter
public abstract class FileExporter extends java.lang.ObjectExports IVirtualFile(s) from a VirtualDrive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileExporter.FileExportOptionsFile importer options
-
Constructor Summary
Constructors Constructor Description FileExporter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Close exporter and release resources.IFileexportFile(IVirtualFile fileToExport, IFile exportDir)Export a file from the drive to the external directory pathIFileexportFile(IVirtualFile fileToExport, IFile exportDir, FileExporter.FileExportOptions options)Export a file from the drive to the external directory pathprotected abstract longgetMinimumPartSize(IVirtualFile file)Get the minimum part of file that can be exported in parallel.voidinitialize(int bufferSize, int threads)Initialize the exporter.booleanisRunning()Check if export is runningprotected abstract voidonPrepare(IVirtualFile sourceFile, boolean integrity)Runs before exportvoidstop()Stop current export
-
-
-
Method Detail
-
onPrepare
protected abstract void onPrepare(IVirtualFile sourceFile, boolean integrity) throws java.io.IOException
Runs before export- Parameters:
sourceFile- The file that will be 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 exported 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)Initialize the exporter.- Parameters:
bufferSize- The buffer size to use while exportingthreads- 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 java.lang.Exception
Export a file from the drive to the external directory path- Parameters:
fileToExport- The file that will be exportedexportDir- The external directory the file will be exported to- Returns:
- The exported file
- Throws:
java.lang.Exception- Thrown if error occurs during export
-
exportFile
public IFile exportFile(IVirtualFile fileToExport, IFile exportDir, FileExporter.FileExportOptions options) throws java.lang.Exception
Export a file from the drive to the external directory path- Parameters:
fileToExport- The file that will be exportedexportDir- The external directory the file will be exported tooptions- The options- Returns:
- The exported file
- Throws:
java.lang.Exception- Thrown if error occurs during export
-
close
public void close()
Close exporter and release resources.
-
-