Package com.biglybt.pif.download
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 Summary
Modifier and TypeMethodDescriptionaddDownload
(Torrent torrent) Add a torrent from a "Torrent" object.addDownload
(Torrent torrent, File torrent_location, File data_location) Add a torrent from a "Torrent" object and point it at the data location.void
addDownload
(File torrent_file) Add a torrent from a file.void
addDownload
(URL url) add a torrent from a URL.void
addDownload
(URL url, boolean auto_download) Add a torrent from a URL with explicit auto-download optionvoid
addDownload
(URL url, URL referer) add a torrent from a URL.void
addDownload
(URL url, Map request_properties) add a torrent from a URL and use the supplied request propertiesaddDownloadStopped
(Torrent torrent, File torrent_location, File data_location) Explicit way of adding a download in a stopped statevoid
addDownloadStubListener
(DownloadStubListener l, boolean inform_of_current) void
void
Add a listener that will be informed when a download is added to and removed from the client.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.addNonPersistentDownload
(Torrent torrent, File torrent_location, File data_location) Add a non-persistent download.addNonPersistentDownloadStopped
(Torrent torrent, File torrent_location, File data_location) boolean
boolean
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 removedReturns the defaultSaveLocationManager
object that controls where downloads should be placed.default Download
getDownload
(byte[] hash) Gets a download given its hashgetDownload
(byte[] hash, boolean check_truncated_hash) getDownload
(Torrent torrent) Gets the download for a particular torrent, returns null if not foundDownload[]
Gets all the downloads.Download[]
getDownloads
(boolean bSorted) Gets all the downloads.int
Return aDownloadEventNotifier
object which can be used as an easy way to register listeners against all downloads handled by the client.Returns the currentSaveLocationManager
object which decides where downloads should be placed.getStats()
Get the download manager statisticsboolean
indicates whether or not all active downloads are in a seeding (or effective) seeding statelookupDownloadStub
(byte[] hash) void
pause all running downloadsvoid
void
void
Removes a previously added listener.void
removeListener
(DownloadManagerListener l, boolean notify_of_current_downloads) Removes a previously added listener.void
resume previously paused downloadsvoid
Registers an object to be in control of determining the default save location for downloads.void
starts all non-running downloadsvoid
stops all running downloads
-
Method Details
-
addDownload
Add a torrent from a file. This may prompt the user for a download location etc. if required. This is an async operation, so no Download is returned. If you want to force a download to be added without prompting the user, you should create a Torrent object first, and then use an alternative addDownload method.- Parameters:
torrent_file
-- Throws:
DownloadException
- Since:
- 2.0.7.0
- See Also:
-
addDownload
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
Add a torrent from a URL with explicit auto-download option- Parameters:
url
-auto_download
-- Throws:
DownloadException
- Since:
- 2403
-
addDownload
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
add a torrent from a URL and use the supplied request properties- Parameters:
url
-request_properties
-- Since:
- 3.0.5.3
-
addDownload
Add a torrent from a "Torrent" object. The default torrent file and data locations will be used if defined - a DownloadException will be thrown if they're not. You can explicitly set these values by using theaddDownload(Torrent, File, File)
method.- Parameters:
torrent
-- Returns:
- Throws:
DownloadException
- Since:
- 2.0.8.0
- See Also:
-
addDownload
Download addDownload(Torrent torrent, File torrent_location, 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 - ifnull
, 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, File torrent_location, 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, File torrent_location, 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
-
addNonPersistentDownloadStopped
Download addNonPersistentDownloadStopped(Torrent torrent, File torrent_location, File data_location) throws DownloadException - Throws:
DownloadException
-
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
Gets the download for a particular torrent, returns null if not found- Parameters:
torrent
-- Returns:
- Since:
- 2.0.7.0
-
getDownload
Gets a download given its hash- Parameters:
hash
-- Returns:
- Throws:
DownloadException
- Since:
- 2.3.0.7
-
getDownload
- Throws:
DownloadException
-
getDownloads
Download[] getDownloads()Gets all the downloads. Returned in Download "index" order- Returns:
- Since:
- 2.0.7.0
-
getDownloads
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
-
getStats
DownloadManagerStats getStats()Get the download manager statistics- Returns:
-
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
Add a listener that will be informed when a download is added to and removed from the client. Invoking this method is equivalent toaddListener(l, true)
.- Parameters:
l
- The listener to add.- Since:
- 2.0.7.0
- See Also:
-
addListener
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 itsdownloadAdded
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
Removes a previously added listener.- Parameters:
l
- The listener to remove.notify_of_current_downloads
- true - if you want the listener to have itsdownloadRemoved
method invoked immediately with all downloads currently managed by the client, false otherwise.- Since:
- 3.0.0.7
-
removeListener
Removes a previously added listener. Invoking this method is equivalent toremoveListener(l, false)
.- Parameters:
l
- The listener to remove.- Since:
- 2.0.7.0
- See Also:
-
addDownloadWillBeAddedListener
-
removeDownloadWillBeAddedListener
-
getGlobalDownloadEventNotifier
DownloadEventNotifier getGlobalDownloadEventNotifier()Return aDownloadEventNotifier
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
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 currentSaveLocationManager
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 defaultSaveLocationManager
object that controls where downloads should be placed.- Returns:
- The default save location manager object.
- Since:
- 3.0.5.3
-
getDownloadStubs
DownloadStub[] getDownloadStubs() -
lookupDownloadStub
-
getDownloadStubCount
int getDownloadStubCount() -
addDownloadStubListener
-
removeDownloadStubListener
-