public class TorrentClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TorrentClient.Builder |
| Modifier and Type | Method and Description |
|---|---|
void |
addDiskJob(IDiskJob task)
Submits the disk job to be processed by the IO manager.
|
int |
createUniqueTransactionId() |
void |
download(Torrent torrent)
Initiates the downloading of a torrent.
|
void |
download(Torrent torrent,
Collection<String> trackerUrls)
Initiates the downloading of a torrent.
|
int |
getConnectingCountFor(Torrent torrent)
Calculates how many connections are assigned to the torrent but haven't passed the BitTorrent handshake yet.
|
ConnectionDegradation |
getConnectionDegradation()
Gets the configured connection degradation rules.
|
int |
getDownloadPort()
Gets the port at which we are listening for peers
|
ScheduledExecutorService |
getExecutorService()
Gets the
ScheduledExecutorService which will execute the small tasks |
byte[] |
getExtensionBytes()
Gets the eight extension bytes which represent which BitTorrent extensions are enabled on this client.
|
MessageFactory |
getMessageFactory()
Gets the message factory for this client
|
<T extends IModule> |
getModule(Class<T> type)
Gets the module instance if it is registered to this Torrent Client.
|
Collection<IModule> |
getModules()
Gets an unmodifiable view of the registered modules to this torrent client.
|
IPeerConnector |
getPeerConnector()
Gets the
IPeerConnector which connects new peers |
IPeerDistributor |
getPeerDistributor() |
byte[] |
getPeerId()
Gets the 20-byte peer ID associated to this tracker manager
|
PhaseRegulator |
getPhaseRegulator()
Gets the
PhaseRegulator which manages the ordering of the download states. |
Optional<Torrent> |
getTorrentByHash(byte[] torrentHash)
Gets the torrent associated with the given hash.
|
int |
getTorrentCount() |
List<ITracker> |
getTrackersFor(Torrent torrent)
Gets all trackers which know the given torrent
|
void |
shutdown()
Shuts down all components of the TorrentClient.
|
public void download(Torrent torrent, Collection<String> trackerUrls)
torrent - The torrent to download.trackerUrls - The trackers which are known for this torrent.public void download(Torrent torrent)
torrent - The torrent to download.public void shutdown()
public int createUniqueTransactionId()
public void addDiskJob(IDiskJob task)
task - The disk job to execute.public int getConnectingCountFor(Torrent torrent)
torrent - The torrent for which connections must be counted.public List<ITracker> getTrackersFor(Torrent torrent)
torrent - the torrent which the tracker must supportpublic MessageFactory getMessageFactory()
MessageFactorypublic ConnectionDegradation getConnectionDegradation()
public PhaseRegulator getPhaseRegulator()
PhaseRegulator which manages the ordering of the download states.public ScheduledExecutorService getExecutorService()
ScheduledExecutorService which will execute the small taskspublic IPeerConnector getPeerConnector()
IPeerConnector which connects new peerspublic int getDownloadPort()
public byte[] getExtensionBytes()
public byte[] getPeerId()
public <T extends IModule> Optional<T> getModule(Class<T> type)
T - The module type.type - The module class.Optional.empty() if not found.public Collection<IModule> getModules()
public Optional<Torrent> getTorrentByHash(byte[] torrentHash)
torrentHash - The BTIH of the torrentpublic IPeerDistributor getPeerDistributor()
IPeerDistributor for this TorrentClientpublic int getTorrentCount()
Copyright © 2016. All rights reserved.