org.gudy.azureus2.plugins.torrent
Interface Torrent

All Known Implementing Classes:
RPTorrent, TorrentImpl

public interface Torrent


Method Summary
 Object getAdditionalProperty(String name)
          Access to top-level properties in the torrent
 URL getAnnounceURL()
           
 TorrentAnnounceURLList getAnnounceURLList()
          get the announce list for multi-tracker torrents.
 Torrent getClone()
           
 String getComment()
           
 String getCreatedBy()
           
 long getCreationDate()
          UNIX epoch format in seconds
 String getEncoding()
           
 TorrentFile[] getFiles()
           
 byte[] getHash()
           
 URL getMagnetURI()
          Gets the magnet URI for the torrent - throws exception if not available
 Map getMapProperty(String name)
          Gets a previously set map value
 String getName()
           
 long getPieceCount()
           
 byte[][] getPieces()
           
 long getPieceSize()
           
 String getPluginStringProperty(String name)
          Get a property specific to this plugin
 long getSize()
          If size is 0 then this is an "external" torrent and we only know its hash (and name constructed from hash).
 boolean isComplete()
           
 boolean isDecentralised()
          A decentralised torrent uses the DHT only as a "tracker"
 boolean isDecentralisedBackupEnabled()
          Decentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailable
 boolean isDecentralisedBackupRequested()
           
 boolean isPrivate()
          A private torrent is either explicitly private via info/private or has decentralised backup disabled and peer exchange disabled
 boolean isSimpleTorrent()
          Returns true if the torrent is a single file torrent, false if it is a multi file torrent.
 Torrent removeAdditionalProperties()
          Removal all non-standard properties (excluding plugin-properties below)
 void save()
          Saves the torrent to its persistent location
 void setAnnounceURL(URL url)
           
 void setComment(String comment)
           
 void setComplete(File data_dir)
          sets the torrent complete - i.e.
 void setDecentralisedBackupRequested(boolean requested)
          By default torrents with OK trackers are not tracked in the DHT.
 void setDefaultEncoding()
           
 void setEncoding(String encoding)
           
 void setMapProperty(String name, Map value)
          Sets a map property in the torrent, retrievable via getMapProperty
 void setPluginStringProperty(String name, String value)
          Set a property specific to this plugin
 void setPrivate(boolean priv)
           
 boolean wasCreatedByUs()
           
 byte[] writeToBEncodedData()
           
 void writeToFile(File file)
           
 Map writeToMap()
           
 

Method Detail

getName

String getName()

getAnnounceURL

URL getAnnounceURL()

setAnnounceURL

void setAnnounceURL(URL url)

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()

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

void setComment(String comment)

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

void setEncoding(String encoding)
                 throws TorrentEncodingException
Throws:
TorrentEncodingException

setDefaultEncoding

void setDefaultEncoding()
                        throws TorrentEncodingException
Throws:
TorrentEncodingException

getAdditionalProperty

Object getAdditionalProperty(String name)
Access to top-level properties in the torrent

Parameters:
name -
Returns:

removeAdditionalProperties

Torrent removeAdditionalProperties()
Removal all non-standard properties (excluding plugin-properties below)

Returns:

setPluginStringProperty

void setPluginStringProperty(String name,
                             String value)
Set a property specific to this plugin

Parameters:
name -
value -

getPluginStringProperty

String getPluginStringProperty(String name)
Get a property specific to this plugin

Parameters:
name -
Returns:

setMapProperty

void setMapProperty(String name,
                    Map value)
Sets a map property in the torrent, retrievable via getMapProperty

Parameters:
name - should be unique across plugins (i.e. prefix it with something unique)
value - bencodable Map value

getMapProperty

Map getMapProperty(String name)
Gets a previously set map value

Parameters:
name - should be unique across plugins (i.e. prefix it with something unique)
Returns:
See Also:
setMapProperty

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

URL getMagnetURI()
                 throws TorrentException
Gets the magnet URI for the torrent - throws exception if not available

Returns:
Throws:
TorrentException

writeToMap

Map writeToMap()
               throws TorrentException
Throws:
TorrentException

writeToFile

void writeToFile(File file)
                 throws TorrentException
Throws:
TorrentException

writeToBEncodedData

byte[] writeToBEncodedData()
                           throws TorrentException
Throws:
TorrentException

save

void save()
          throws TorrentException
Saves the torrent to its persistent location

Throws:
TorrentException

setComplete

void setComplete(File data_dir)
                 throws TorrentException
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

Torrent getClone()
                 throws TorrentException
Throws:
TorrentException