Class FastDownloader
java.lang.Object
ch.ethz.sis.openbis.generic.dssapi.v3.fastdownload.FastDownloader
Helper class for downloading files by using an instance of a
FastDownloadSession instance. Typical usage:
ListfileIds = ...; FastDownloadSessionOptions options = new FastDownloadSessionOptions().wishedNumberOfStreams(3); FastDownloadSession downloadSession = dataStoreServer.createFastDownloadSession(sessionToken, fileIds, options); File target = ...; FastDownloadResult result = new FastDownloader(downloadSession).downloadTo(target); if (result.getStatus() == DownloadStatus.FINISHED) { // success }
-
Constructor Summary
ConstructorsConstructorDescriptionFastDownloader(FastDownloadSession session) Creates an instance for the specified download session object. -
Method Summary
Modifier and TypeMethodDescriptiondownloadTo(File folder) Runs the download session an stores all downloaded files in the specified folder.ch.ethz.sis.filetransfer.IDownloadServerReturns the remote fast download server.toString()withListener(ch.ethz.sis.filetransfer.IDownloadListener listener) Adds a download listener.withLogger(ch.ethz.sis.filetransfer.ILogger logger) Sets the logger used by the internal download client.withRetryProviderFactory(ch.ethz.sis.filetransfer.IRetryProviderFactory retryProviderFactory) Sets the factory for anIRetryProvider.
-
Constructor Details
-
FastDownloader
Creates an instance for the specified download session object.
-
-
Method Details
-
getDownloadServer
public ch.ethz.sis.filetransfer.IDownloadServer getDownloadServer()Returns the remote fast download server. This is useful in case of direct communication with the server. -
withLogger
Sets the logger used by the internal download client. The default logger is an instance ofNullLoggerwhich logs nothing.- Returns:
- this instance
-
withListener
Adds a download listener. The internal download client will send events to the listener during the download session.- Returns:
- this instance
-
withRetryProviderFactory
public FastDownloader withRetryProviderFactory(ch.ethz.sis.filetransfer.IRetryProviderFactory retryProviderFactory) Sets the factory for anIRetryProvider. The default isDefaultRetryProviderwith maximumNumberOfRetries = 3, waitingTimeBetweenRetries = 1 sec, waitingTimeBetweenRetriesIncreasingFactor = 2.- Returns:
- this instance
-
downloadTo
Runs the download session an stores all downloaded files in the specified folder.- Returns:
- the result of the download session.
-
toString
-