Class FileExporter

  • Direct Known Subclasses:
    AesFileExporter

    public abstract class FileExporter
    extends java.lang.Object
    Exports IVirtualFile(s) from a VirtualDrive.
    • Constructor Detail

      • FileExporter

        public FileExporter()
    • 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 imported
        integrity - 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 exporting
        threads - 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 exported
        exportDir - 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 exported
        exportDir - The external directory the file will be exported to
        options - 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.