Interface Torrent
- All Known Implementing Classes:
RPTorrent, TorrentImpl
public interface Torrent
-
Method Summary
Modifier and TypeMethodDescriptiongetAdditionalProperty(String name) Access to top-level properties in the torrentget the announce list for multi-tracker torrents.getClone()longUNIX epoch format in secondsgetFiles()default byte[]getFullHash(int type) byte[]getHash()v1 torrent hash or truncated v2 hash if v2 onlyGets the magnet URI for the torrent - throws exception if not availablegetMapProperty(String name) Gets a previously set map valuegetName()longbyte[][]longGet a property specific to this pluginlonggetSize()If size is 0 then this is an "external" torrent and we only know its hash (and name constructed from hash).booleanbooleanA decentralised torrent uses the DHT only as a "tracker"booleanDecentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailablebooleanbooleanA private torrent is either explicitly private via info/private or has decentralised backup disabled and peer exchange disabledbooleanReturns true if the torrent is a single file torrent, false if it is a multi file torrent.Removal all non-standard properties (excluding plugin-properties below)voidsave()Saves the torrent to its persistent locationvoidsetAnnounceURL(URL url) voidsetComment(String comment) voidsetComplete(File data_dir) sets the torrent complete - i.e.voidsetDecentralisedBackupRequested(boolean requested) By default torrents with OK trackers are not tracked in the DHT.voidvoidsetEncoding(String encoding) voidsetMapProperty(String name, Map value) Sets a map property in the torrent, retrievable via getMapPropertyvoidsetPluginStringProperty(String name, String value) Set a property specific to this pluginvoidsetPrivate(boolean priv) booleanbyte[]voidwriteToFile(File file)
-
Method Details
-
getName
String getName() -
getAnnounceURL
URL getAnnounceURL() -
setAnnounceURL
-
getAnnounceURLList
TorrentAnnounceURLList getAnnounceURLList()get the announce list for multi-tracker torrents. Will always be present but may contain 0 sets which means that this is not a multi-tracker torrent- Returns:
-
getHash
byte[] getHash()v1 torrent hash or truncated v2 hash if v2 only- Returns:
-
getFullHash
default byte[] getFullHash(int type) - Returns:
- v2 torrent hash if hybrid or v2 only torrent
-
getSize
long getSize()If size is 0 then this is an "external" torrent and we only know its hash (and name constructed from hash). e.g. we don't know file details- Returns:
-
getComment
String getComment() -
setComment
-
getCreationDate
long getCreationDate()UNIX epoch format in seconds -
getCreatedBy
String getCreatedBy() -
getPieceSize
long getPieceSize() -
getPieceCount
long getPieceCount() -
getPieces
byte[][] getPieces() -
getFiles
TorrentFile[] getFiles() -
getEncoding
String getEncoding() -
setEncoding
- Throws:
TorrentEncodingException
-
setDefaultEncoding
- Throws:
TorrentEncodingException
-
getAdditionalProperty
-
removeAdditionalProperties
Torrent removeAdditionalProperties()Removal all non-standard properties (excluding plugin-properties below)- Returns:
-
setPluginStringProperty
-
getPluginStringProperty
-
setMapProperty
-
getMapProperty
-
isDecentralised
boolean isDecentralised()A decentralised torrent uses the DHT only as a "tracker"- Returns:
-
isDecentralisedBackupEnabled
boolean isDecentralisedBackupEnabled()Decentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailable- Returns:
-
setDecentralisedBackupRequested
void setDecentralisedBackupRequested(boolean requested) By default torrents with OK trackers are not tracked in the DHT. This allows a specific torrent to be marked so that it will be- Parameters:
requested-
-
isDecentralisedBackupRequested
boolean isDecentralisedBackupRequested() -
isPrivate
boolean isPrivate()A private torrent is either explicitly private via info/private or has decentralised backup disabled and peer exchange disabled- Returns:
-
setPrivate
void setPrivate(boolean priv) -
wasCreatedByUs
boolean wasCreatedByUs()- Returns:
- Since:
- 2501
-
getMagnetURI
Gets the magnet URI for the torrent - throws exception if not available- Returns:
- Throws:
TorrentException
-
writeToMap
- Throws:
TorrentException
-
writeToFile
- Throws:
TorrentException
-
writeToBEncodedData
- Throws:
TorrentException
-
save
Saves the torrent to its persistent location- Throws:
TorrentException
-
setComplete
sets the torrent complete - i.e. ready for seeding. Doing this avoids a recheck on torrent addition- Parameters:
data_dir-- Throws:
TorrentException
-
isComplete
boolean isComplete() -
isSimpleTorrent
boolean isSimpleTorrent()Returns true if the torrent is a single file torrent, false if it is a multi file torrent.- Since:
- 3.0.4.3
-
getClone
- Throws:
TorrentException
-