Class FileDownloader


  • public class FileDownloader
    extends FileOperation
    This is an internal class and not meant to be used by the end users of the filesystem API. The consequences of using this class directly in client code is not guaranteed and maybe undesirable. This class handles downloading of either single part file or multiple part downloads. This class extends the class FileOperation and provides additional functionalities of creating instances of DownloadIoJob, starting them and waiting for them to terminate. The main exposed method to call is download() ()} which calls two private methods named downloadFullFiles() ()} and downloadMultiPartFiles() ()} respectively. The method downloadFullFiles() ()} does the download by calling the Java endpoint to download all files in one go. The method downloadMultiPartFiles() ()} does the downloads by creating background threads since each file could take a long time to download. The multiple parts of a single file are downloaded sequentially in a single thread and multiple files are downloaded in different threads.
    • Constructor Detail

      • FileDownloader

        public FileDownloader​(GPUdb db,
                              List<String> fileNames,
                              String localDirName,
                              DownloadOptions options,
                              FileDownloadListener callback,
                              GPUdbFileHandler.Options fileHandlerOptions)
                       throws GPUdbException
        Constructs a new FileDownloader manager for downloading a given set of files from a given KiFS directory to a local directory.
        Parameters:
        db - The GPUdb instance used to access KiFS.
        fileNames - List of names of the KiFS files to download.
        localDirName - Name of local directory to download to.
        options - The DownloadOptions object which is used to configure the download operation.
        callback - The callback FileDownloadListener for this download manager to notify as the download job progresses.
        fileHandlerOptions - Options for setting up the files for transfer.
        Throws:
        GPUdbException
    • Method Detail

      • download

        public void download()
                      throws GPUdbException
        This is the main download method which is to be called by the users of this class. Internally depending whether there are files to be downloaded one shot or in parts it will call the methods downloadFullFiles() ()} and downloadMultiPartFiles() ()}
        Throws:
        GPUdbException - If an error occurs transferring any of the files from the server.