Class AddTorrentParams
java.lang.Object
com.frostwire.jlibtorrent.AddTorrentParams
The
AddTorrentParams is a parameter pack for adding torrents to a
session. The key fields when adding a torrent are:
- ti - when you have a .torrent file
- url - when you have a magnet link or http URL to the .torrent file
- info_hash - when all you have is an info-hash (this is similar to a magnet link)
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 Summary
ConstructorsConstructorDescriptionCreates an empty parameters object with the default storage.The native object -
Method Summary
Modifier and TypeMethodDescriptionPeers banned from this torrent.voidbannedPeers(List<TcpEndpoint> value) Peers banned from this torrent.static AddTorrentParamsdhtNodes()A list of hostname and port pairs, representing DHT nodes to be added to the session (if DHT is enabled).voidA list of hostname and port pairs, representing DHT nodes to be added to the session (if DHT is enabled).intvoiddownloadLimit(int value) voidfilePriorities(Priority[] priorities) Can be set to control the initial file priorities when adding a torrent.flags()Flags controlling aspects of this torrent and how it's added.voidflags(torrent_flags_t flags) Flags controlling aspects of this torrent and how it's added.Set this to the info hash of the torrent to add in case the info-hash is the only known property of the torrent.intvoidmaxConnections(int value) intvoidmaxUploads(int value) name()voidstatic AddTorrentParamsparseMagnetUri(String uri) Helper function to parse a magnet uri and fill the parameters.peers()Peers to add to the torrent, to be tried to be connected to as bittorrent peers.voidpeers(List<TcpEndpoint> value) Peers to add to the torrent, to be tried to be connected to as bittorrent peers.voidpiecePriorities(Priority[] priorities) This sets the priorities for each individual piece in the torrent.savePath()The path where the torrent is or will be stored.voidThe path where the torrent is or will be stored.voidsetInfoHashes(InfoHash 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.voidstorageMode(StorageMode value) swig()TorrentInfoobject with the torrent to add.voidTorrentInfoobject with the torrent to add.The default tracker id to be used when announcing to trackers.voidThe default tracker id to be used when announcing to trackers.trackers()If the torrent doesn't have a tracker, but relies on the DHT to find peers, thetrackers(List)can specify tracker URLs for the torrent.voidIf the torrent doesn't have a tracker, but relies on the DHT to find peers, this method can specify tracker URLs for the torrent.The tiers the URLs intrackers()belong to.voidtrackerTiers(List<Integer> value) The tiers the URLs intrackers()belong to.intvoiduploadLimit(int value) urlSeeds()Url seeds to be added to the torrent (`BEP 17`_).voidUrl seeds to be added to the torrent (`BEP 17`_).intversion()Filled in by the constructor.static EntrywriteResumeData(AddTorrentParams params) Turns the resume data in an `AddTorrentParams` object into a bencoded structure.
-
Constructor Details
-
AddTorrentParams
-
AddTorrentParams
public AddTorrentParams()Creates an empty parameters object with the default storage.
-
-
Method Details
-
swig
- Returns:
- the native object
-
version
public int version()Filled in by the constructor. It is used for forward binary compatibility.- Returns:
- the version
-
torrentInfo
TorrentInfoobject with the torrent to add.- Returns:
- the torrent info or null if not set
-
torrentInfo
TorrentInfoobject with the torrent to add.- Parameters:
ti- the torrent info
-
trackers
If the torrent doesn't have a tracker, but relies on the DHT to find peers, thetrackers(List)can specify tracker URLs for the torrent.- Returns:
- the list of trackers
-
trackers
-
trackerTiers
The tiers the URLs intrackers()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.- Returns:
- the list of trackers tiers
-
trackerTiers
The tiers the URLs intrackers()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.- Parameters:
value- the list of trackers tiers
-
dhtNodes
-
get_verified_leaf_hashes
-
dhtNodes
-
name
- Returns:
- the name
-
name
- Parameters:
value- the name
-
savePath
The path where the torrent is or will be stored. Note that this may also be stored in resume data. If you want the save path saved in the resume data to be used, you need to set the flag_use_resume_save_path flag... note:: On windows this path (and other paths) are interpreted as UNC paths. This means they must use backslashes as directory separators
- Returns:
- the save path
-
savePath
The path where the torrent is or will be stored. Note that this may also be stored in resume data. If you want the save path saved in the resume data to be used, you need to set the flag_use_resume_save_path flag... note:: On windows this path (and other paths) are interpreted as UNC paths. This means they must use backslashes as directory separators
- Parameters:
value- the save path
-
storageMode
- Returns:
- the storage mode
- See Also:
-
storageMode
- Parameters:
value- the storage mode- See Also:
-
trackerId
The default tracker id to be used when announcing to trackers. By default this is empty, and no tracker ID is used, since this is an optional argument. If a tracker returns a tracker ID, that ID is used instead of this.- Returns:
- the trackerid url parameter
-
trackerId
The default tracker id to be used when announcing to trackers. By default this is empty, and no tracker ID is used, since this is an optional argument. If a tracker returns a tracker ID, that ID is used instead of this.- Parameters:
value- the trackerid url parameter
-
getInfoHashes
Set this to the info hash of the torrent to add in case the info-hash is the only known property of the torrent. i.e. you don't have a .torrent file nor a magnet link.- Returns:
- the info-hash
-
setInfoHashes
Set this to the info hash of the torrent to add in case the info-hash is the only known property of the torrent. i.e. you don't have a .torrent file nor a magnet link.- Parameters:
value- the info-hash
-
maxUploads
public int maxUploads()- Returns:
- max uploads limit
-
maxUploads
public void maxUploads(int value) - Parameters:
value- max uploads limit
-
maxConnections
public int maxConnections()- Returns:
- max connections limit
-
maxConnections
public void maxConnections(int value) - Parameters:
value- max connections limit
-
uploadLimit
public int uploadLimit()- Returns:
- upload limit
-
uploadLimit
public void uploadLimit(int value) - Parameters:
value- upload limit
-
downloadLimit
public int downloadLimit()- Returns:
- download limit
-
downloadLimit
public void downloadLimit(int value) - Parameters:
value- download limit
-
flags
Flags controlling aspects of this torrent and how it's added.- Returns:
- the flags
-
flags
Flags controlling aspects of this torrent and how it's added.- Parameters:
flags- the flags
-
urlSeeds
-
urlSeeds
-
filePriorities
Can be set to control the initial file priorities when adding a torrent. The semantics are the same as forTorrentHandle.prioritizeFiles(Priority[]).- Parameters:
priorities- the priorities
-
piecePriorities
This sets the priorities for each individual piece in the torrent. Each element in the vector represent the piece with the same index. If you set both file- and piece priorities, file priorities will take precedence.- Parameters:
priorities- the priorities
-
peers
Peers to add to the torrent, to be tried to be connected to as bittorrent peers.- Returns:
- the peers list
-
peers
Peers to add to the torrent, to be tried to be connected to as bittorrent peers.- Parameters:
value- the peers list
-
bannedPeers
Peers banned from this torrent. The will not be connected to.- Returns:
- the peers list
-
bannedPeers
Peers banned from this torrent. The will not be connected to.- Parameters:
value- the peers list
-
createInstance
- Returns:
- an instance with the default storage
-
parseMagnetUri
Helper function to parse a magnet uri and fill the parameters.- Parameters:
uri- the magnet uri- Returns:
- the params object filled with the data from the magnet
-
writeResumeData
Turns the resume data in an `AddTorrentParams` object into a bencoded structure.
-