java.lang.Object
ch.ethz.sis.openbis.generic.dssapi.v3.fastdownload.FastDownloader

public class FastDownloader extends Object
Helper class for downloading files by using an instance of a FastDownloadSession 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 Details

    • FastDownloader

      public FastDownloader(FastDownloadSession session)
      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

      public FastDownloader withLogger(ch.ethz.sis.filetransfer.ILogger logger)
      Sets the logger used by the internal download client. The default logger is an instance of NullLogger 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 an IRetryProvider. The default is DefaultRetryProvider with maximumNumberOfRetries = 3, waitingTimeBetweenRetries = 1 sec, waitingTimeBetweenRetriesIncreasingFactor = 2.
      Returns:
      this instance
    • downloadTo

      public FastDownloadResult downloadTo(File folder)
      Runs the download session an stores all downloaded files in the specified folder.
      Returns:
      the result of the download session.
    • toString

      public String toString()
      Overrides:
      toString in class Object