Class FastDownloader
- java.lang.Object
-
- ch.ethz.sis.openbis.generic.dssapi.v3.fastdownload.FastDownloader
-
public class FastDownloader extends java.lang.Object
Helper class for downloading files by using an instance of aFastDownloadSession
instance. Typical usage:List
fileIds = ...; 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
Constructors Constructor Description FastDownloader(FastDownloadSession session)
Creates an instance for the specified download session object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FastDownloadResult
downloadTo(java.io.File folder)
Runs the download session an stores all downloaded files in the specified folder.ch.ethz.sis.filetransfer.IDownloadServer
getDownloadServer()
Returns the remote fast download server.java.lang.String
toString()
FastDownloader
withListener(ch.ethz.sis.filetransfer.IDownloadListener listener)
Adds a download listener.FastDownloader
withLogger(ch.ethz.sis.filetransfer.ILogger logger)
Sets the logger used by the internal download client.FastDownloader
withRetryProviderFactory(ch.ethz.sis.filetransfer.IRetryProviderFactory retryProviderFactory)
Sets the factory for anIRetryProvider
.
-
-
-
Constructor Detail
-
FastDownloader
public FastDownloader(FastDownloadSession session)
Creates an instance for the specified download session object.
-
-
Method Detail
-
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
public FastDownloader withLogger(ch.ethz.sis.filetransfer.ILogger logger)
Sets the logger used by the internal download client. The default logger is an instance ofNullLogger
which logs nothing.- Returns:
- this instance
-
withListener
public FastDownloader withListener(ch.ethz.sis.filetransfer.IDownloadListener listener)
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 isDefaultRetryProvider
with maximumNumberOfRetries = 3, waitingTimeBetweenRetries = 1 sec, waitingTimeBetweenRetriesIncreasingFactor = 2.- Returns:
- this instance
-
downloadTo
public FastDownloadResult downloadTo(java.io.File folder)
Runs the download session an stores all downloaded files in the specified folder.- Returns:
- the result of the download session.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-