Class FastDownloader


  • public class FastDownloader
    extends java.lang.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 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 an IRetryProvider.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 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​(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 class java.lang.Object