public final class AddTorrentParams
extends java.lang.Object
AddTorrentParams is a parameter pack for adding torrents to a
session. The key fields when adding a torrent are:
savePath(). The AddTorrentParams object is passed into one of the
SessionHandle.addTorrent(AddTorrentParams, ErrorCode) overloads or
SessionHandle.asyncAddTorrent(AddTorrentParams).
If you only specify the info-hash, the torrent file will be downloaded
from peers, which requires them to support the metadata extension. It also
takes an optional name() argument. This may be left empty in case no
name should be assigned to the torrent. In case it's not, the name is
used for the torrent as long as it doesn't have metadata.
| Constructor and Description |
|---|
AddTorrentParams()
Creates an empty parameters object with the default storage.
|
AddTorrentParams(add_torrent_params p)
The native object
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<TcpEndpoint> |
bannedPeers()
Peers banned from this torrent.
|
void |
bannedPeers(java.util.List<TcpEndpoint> value)
Peers banned from this torrent.
|
static AddTorrentParams |
createInstance() |
static AddTorrentParams |
createInstanceDisabledStorage() |
static AddTorrentParams |
createInstanceZeroStorage() |
java.util.ArrayList<Pair<java.lang.String,java.lang.Integer>> |
dhtNodes()
A list of hostname and port pairs, representing DHT nodes to be added
to the session (if DHT is enabled).
|
void |
dhtNodes(java.util.List<Pair<java.lang.String,java.lang.Integer>> value)
A list of hostname and port pairs, representing DHT nodes to be added
to the session (if DHT is enabled).
|
int |
downloadLimit() |
void |
downloadLimit(int value) |
void |
filePriorities(Priority[] priorities)
Can be set to control the initial file priorities when adding a
torrent.
|
torrent_flags_t |
flags()
Flags controlling aspects of this torrent and how it's added.
|
void |
flags(torrent_flags_t flags)
Flags controlling aspects of this torrent and how it's added.
|
Sha1Hash |
infoHash()
Set this to the info hash of the torrent to add in case the info-hash
is the only known property of the torrent.
|
void |
infoHash(Sha1Hash value)
Set this to the info hash of the torrent to add in case the info-hash
is the only known property of the torrent.
|
int |
maxConnections() |
void |
maxConnections(int value) |
int |
maxUploads() |
void |
maxUploads(int value) |
java.lang.String |
name() |
void |
name(java.lang.String value) |
static AddTorrentParams |
parseMagnetUri(java.lang.String uri)
Helper function to parse a magnet uri and fill the parameters.
|
java.util.ArrayList<TcpEndpoint> |
peers()
Peers to add to the torrent, to be tried to be connected to as
bittorrent peers.
|
void |
peers(java.util.List<TcpEndpoint> value)
Peers to add to the torrent, to be tried to be connected to as
bittorrent peers.
|
void |
piecePriorities(Priority[] priorities)
This sets the priorities for each individual piece in the torrent.
|
java.lang.String |
savePath()
The path where the torrent is or will be stored.
|
void |
savePath(java.lang.String value)
The path where the torrent is or will be stored.
|
StorageMode |
storageMode() |
void |
storageMode(StorageMode value) |
add_torrent_params |
swig() |
TorrentInfo |
torrentInfo()
TorrentInfo object with the torrent to add. |
void |
torrentInfo(TorrentInfo ti)
TorrentInfo object with the torrent to add. |
java.lang.String |
trackerId()
The default tracker id to be used when announcing to trackers.
|
void |
trackerId(java.lang.String value)
The default tracker id to be used when announcing to trackers.
|
java.util.ArrayList<java.lang.String> |
trackers()
If the torrent doesn't have a tracker, but relies on the DHT to find
peers, the
trackers(List) can specify tracker URLs for the
torrent. |
void |
trackers(java.util.List<java.lang.String> value)
If the torrent doesn't have a tracker, but relies on the DHT to find
peers, this method can specify tracker URLs for the torrent.
|
java.util.ArrayList<java.lang.Integer> |
trackerTiers()
The tiers the URLs in
trackers() belong to. |
void |
trackerTiers(java.util.List<java.lang.Integer> value)
The tiers the URLs in
trackers() belong to. |
int |
uploadLimit() |
void |
uploadLimit(int value) |
java.util.ArrayList<java.lang.String> |
urlSeeds()
Url seeds to be added to the torrent (`BEP 17`_).
|
void |
urlSeeds(java.util.List<java.lang.String> value)
Url seeds to be added to the torrent (`BEP 17`_).
|
int |
version()
Filled in by the constructor.
|
public AddTorrentParams(add_torrent_params p)
p - the native objectpublic AddTorrentParams()
public add_torrent_params swig()
public int version()
public TorrentInfo torrentInfo()
TorrentInfo object with the torrent to add.public void torrentInfo(TorrentInfo ti)
TorrentInfo object with the torrent to add.ti - the torrent infopublic java.util.ArrayList<java.lang.String> trackers()
trackers(List) can specify tracker URLs for the
torrent.public void trackers(java.util.List<java.lang.String> value)
value - the list of trackerspublic java.util.ArrayList<java.lang.Integer> trackerTiers()
trackers() belong to. Trackers belonging to
different tiers may be treated differently, as defined by the multi
tracker extension. This is optional, if not specified trackers are
assumed to be part of tier 0, or whichever the last tier was as
iterating over the trackers.public void trackerTiers(java.util.List<java.lang.Integer> value)
trackers() belong to. Trackers belonging to
different tiers may be treated differently, as defined by the multi
tracker extension. This is optional, if not specified trackers are
assumed to be part of tier 0, or whichever the last tier was as
iterating over the trackers.value - the list of trackers tierspublic java.util.ArrayList<Pair<java.lang.String,java.lang.Integer>> dhtNodes()
public void dhtNodes(java.util.List<Pair<java.lang.String,java.lang.Integer>> value)
value - the list of DHT nodespublic java.lang.String name()
public void name(java.lang.String value)
value - the namepublic java.lang.String savePath()
.. note:: On windows this path (and other paths) are interpreted as UNC paths. This means they must use backslashes as directory separators
public void savePath(java.lang.String value)
.. note:: On windows this path (and other paths) are interpreted as UNC paths. This means they must use backslashes as directory separators
value - the save pathpublic StorageMode storageMode()
StorageModepublic void storageMode(StorageMode value)
value - the storage modeStorageModepublic java.lang.String trackerId()
public void trackerId(java.lang.String value)
value - the trackerid url parameterpublic Sha1Hash infoHash()
public void infoHash(Sha1Hash value)
value - the info-hashpublic int maxUploads()
public void maxUploads(int value)
value - max uploads limitpublic int maxConnections()
public void maxConnections(int value)
value - max connections limitpublic int uploadLimit()
public void uploadLimit(int value)
value - upload limitpublic int downloadLimit()
public void downloadLimit(int value)
value - download limitpublic torrent_flags_t flags()
public void flags(torrent_flags_t flags)
flags - the flagspublic java.util.ArrayList<java.lang.String> urlSeeds()
public void urlSeeds(java.util.List<java.lang.String> value)
value - the url seedspublic void filePriorities(Priority[] priorities)
TorrentHandle.prioritizeFiles(Priority[]).priorities - the prioritiespublic void piecePriorities(Priority[] priorities)
priorities - the prioritiespublic java.util.ArrayList<TcpEndpoint> peers()
public void peers(java.util.List<TcpEndpoint> value)
value - the peers listpublic java.util.ArrayList<TcpEndpoint> bannedPeers()
public void bannedPeers(java.util.List<TcpEndpoint> value)
value - the peers listpublic static AddTorrentParams createInstance()
public static AddTorrentParams createInstanceDisabledStorage()
public static AddTorrentParams createInstanceZeroStorage()
public static AddTorrentParams parseMagnetUri(java.lang.String uri)
uri - the magnet uri