Package com.gpudb.filesystem.download
Class FileDownloader
- java.lang.Object
-
- com.gpudb.filesystem.common.FileOperation
-
- com.gpudb.filesystem.download.FileDownloader
-
public class FileDownloader extends FileOperation
This is an internal class and not meant to be used by the end users of thefilesystemAPI. 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 classFileOperationand provides additional functionalities of creating instances ofDownloadIoJob, starting them and waiting for them to terminate. The main exposed method to call isdownload()()} which calls two private methods nameddownloadFullFiles()()} anddownloadMultiPartFiles()()} respectively. The methoddownloadFullFiles()()} does the download by calling the Java endpoint to download all files in one go. The methoddownloadMultiPartFiles()()} 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.
-
-
Field Summary
-
Fields inherited from class com.gpudb.filesystem.common.FileOperation
db, dirName, fileHandlerOptions, fileNames, fullFileBatchManager, fullFileList, multiPartList, multiPartRemoteFileNames, namesOfFilesUploaded, opMode, recursive
-
-
Constructor Summary
Constructors Constructor Description FileDownloader(GPUdb db, List<String> fileNames, String localDirName, DownloadOptions options, FileDownloadListener callback, GPUdbFileHandler.Options fileHandlerOptions)Constructs a newFileDownloadermanager for downloading a given set of files from a given KiFS directory to a local directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddownload()This is the main download method which is to be called by the users of this class.-
Methods inherited from class com.gpudb.filesystem.common.FileOperation
decideMultiPart, getFileInfoFromServer, getKifsPathSeparator, getNamesOfFilesUploaded, localDirExists, localFileExists, parseFileNames, searchLocalDirectories, sortFilesIntoFullAndMultipartLists
-
-
-
-
Constructor Detail
-
FileDownloader
public FileDownloader(GPUdb db, List<String> fileNames, String localDirName, DownloadOptions options, FileDownloadListener callback, GPUdbFileHandler.Options fileHandlerOptions) throws GPUdbException
Constructs a newFileDownloadermanager for downloading a given set of files from a given KiFS directory to a local directory.- Parameters:
db- TheGPUdbinstance used to access KiFS.fileNames- List of names of the KiFS files to download.localDirName- Name of local directory to download to.options- TheDownloadOptionsobject which is used to configure the download operation.callback- The callbackFileDownloadListenerfor 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 GPUdbExceptionThis 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 methodsdownloadFullFiles()()} anddownloadMultiPartFiles()()}- Throws:
GPUdbException- If an error occurs transferring any of the files from the server.
-
-