Interface DownloadManager

  • All Known Implementing Classes:
    DownloadManagerImpl, RPDownloadManager

    public interface DownloadManager
    The DownloadManager gives access to functions used to monitor and manage the client's downloads
    • Method Detail

      • addDownload

        void addDownload​(java.net.URL url)
                  throws DownloadException
        add a torrent from a URL. This will prompt the user for download location etc. if required This is an async operation so no Download returned
        Parameters:
        url -
        Throws:
        DownloadException
        Since:
        2.0.7.0
      • addDownload

        void addDownload​(java.net.URL url,
                         boolean auto_download)
                  throws DownloadException
        Add a torrent from a URL with explicit auto-download option
        Parameters:
        url -
        auto_download -
        Throws:
        DownloadException
        Since:
        2403
      • addDownload

        void addDownload​(java.net.URL url,
                         java.net.URL referer)
        add a torrent from a URL. This will prompt the user for download location etc. if required This is an async operation so no Download returned
        Parameters:
        url -
        referer -
        Throws:
        DownloadException
        Since:
        2.1.0.6
      • addDownload

        void addDownload​(java.net.URL url,
                         java.util.Map request_properties)
        add a torrent from a URL and use the supplied request properties
        Parameters:
        url -
        request_properties -
        Since:
        3.0.5.3
      • addDownload

        Download addDownload​(Torrent torrent,
                             java.io.File torrent_location,
                             java.io.File data_location)
                      throws DownloadException
        Add a torrent from a "Torrent" object and point it at the data location. The torrent_location should be the location of where the torrent file is on disk. This will be the torrent file that the client will use internally. If null is passed, then a file to store the torrent data in will be automatically created by the client.
        Parameters:
        torrent - The torrent object to create a download with.
        torrent_location - The location of the file on disk - if null, a file to store the torrent data into will be created automatically.
        data_location - null -> user default data save location if defined
        Returns:
        support for null params for torrent_location/data_location since 2.1.0.4
        Throws:
        DownloadException
        Since:
        2.0.7.0
      • addDownloadStopped

        Download addDownloadStopped​(Torrent torrent,
                                    java.io.File torrent_location,
                                    java.io.File data_location)
                             throws DownloadException
        Explicit way of adding a download in a stopped state
        Parameters:
        torrent -
        torrent_location -
        data_location -
        Returns:
        Throws:
        DownloadException
        Since:
        3013
      • addNonPersistentDownload

        Download addNonPersistentDownload​(Torrent torrent,
                                          java.io.File torrent_location,
                                          java.io.File data_location)
                                   throws DownloadException
        Add a non-persistent download. Such downloads are not persisted by the client and as such will not be remembered across an client close and restart.
        Parameters:
        torrent -
        torrent_location -
        data_location -
        Returns:
        Throws:
        DownloadException
        Since:
        2.0.7.0
      • clearNonPersistentDownloadState

        void clearNonPersistentDownloadState​(byte[] hash)
        Although non-persistent downloads themselves aren't rememebered across restarts, some internal stats are (for continuity, like total up/down, file allocation state) - this method allows this to be removed
        Parameters:
        hash -
      • getDownload

        Download getDownload​(Torrent torrent)
        Gets the download for a particular torrent, returns null if not found
        Parameters:
        torrent -
        Returns:
        Since:
        2.0.7.0
      • getDownloads

        Download[] getDownloads()
        Gets all the downloads. Returned in Download "index" order
        Returns:
        Since:
        2.0.7.0
      • getDownloads

        Download[] getDownloads​(boolean bSorted)
        Gets all the downloads.
        Parameters:
        bSorted - true - Returned in Download "index" order.
        false - Order not guaranteed. Faster retrieval.
        Returns:
        array of Download object
        Since:
        2.0.8.0
      • pauseDownloads

        void pauseDownloads()
        pause all running downloads
        Since:
        2.1.0.5
      • canPauseDownloads

        boolean canPauseDownloads()
      • resumeDownloads

        void resumeDownloads()
        resume previously paused downloads
        Since:
        2.1.0.5
      • canResumeDownloads

        boolean canResumeDownloads()
      • startAllDownloads

        void startAllDownloads()
        starts all non-running downloads
        Since:
        2.1.0.5
      • stopAllDownloads

        void stopAllDownloads()
        stops all running downloads
        Since:
        2.1.0.5
      • isSeedingOnly

        boolean isSeedingOnly()
        indicates whether or not all active downloads are in a seeding (or effective) seeding state
        Returns:
        Since:
        2.3.0.5
      • addListener

        void addListener​(DownloadManagerListener l,
                         boolean notify_of_current_downloads)
        Add a listener that will be informed when a download is added to and removed from the client.
        Parameters:
        l - The listener to add.
        notify_of_current_downloads - true - if you want the listener to have its downloadAdded method invoked immediately with all downloads currently managed by the client. false - if you only want to be notified about new downloads added after this method is called.
        Since:
        3.0.0.7
      • removeListener

        void removeListener​(DownloadManagerListener l,
                            boolean notify_of_current_downloads)
        Removes a previously added listener.
        Parameters:
        l - The listener to remove.
        notify_of_current_downloads - true - if you want the listener to have its downloadRemoved method invoked immediately with all downloads currently managed by the client, false otherwise.
        Since:
        3.0.0.7
      • getGlobalDownloadEventNotifier

        DownloadEventNotifier getGlobalDownloadEventNotifier()
        Return a DownloadEventNotifier object which can be used as an easy way to register listeners against all downloads handled by the client.
        Since:
        3.0.1.5
      • setSaveLocationManager

        void setSaveLocationManager​(SaveLocationManager manager)
        Registers an object to be in control of determining the default save location for downloads. You can set it to null to remove any object which was previously set.

        By default, the client will use its default save location manager which handles on-completion and on-removal events.

        Parameters:
        manager - The new manager object to use.
        Since:
        3.0.5.3
      • getSaveLocationManager

        SaveLocationManager getSaveLocationManager()
        Returns the current SaveLocationManager object which decides where downloads should be placed.
        Returns:
        The manager object currently in use.
        Since:
        3.0.5.3
      • getDefaultSaveLocationManager

        DefaultSaveLocationManager getDefaultSaveLocationManager()
        Returns the default SaveLocationManager object that controls where downloads should be placed.
        Returns:
        The default save location manager object.
        Since:
        3.0.5.3
      • lookupDownloadStub

        DownloadStub lookupDownloadStub​(byte[] hash)
      • getDownloadStubCount

        int getDownloadStubCount()
      • addDownloadStubListener

        void addDownloadStubListener​(DownloadStubListener l,
                                     boolean inform_of_current)