org.gudy.azureus2.pluginsimpl.remote.torrent
Class RPTorrent

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.remote.RPObject
      extended by org.gudy.azureus2.pluginsimpl.remote.torrent.RPTorrent
All Implemented Interfaces:
java.io.Serializable, Torrent

public class RPTorrent
extends RPObject
implements Torrent

See Also:
Serialized Form

Field Summary
protected  Torrent delegate
           
 byte[] hash
           
 java.lang.String name
           
 long size
           
 
Fields inherited from class org.gudy.azureus2.pluginsimpl.remote.RPObject
__delegate, _dispatcher, _object_id, next_key, object_registry, object_registry_reverse
 
Constructor Summary
protected RPTorrent(Torrent _delegate)
           
 
Method Summary
 RPReply _process(RPRequest request)
           
protected  void _setDelegate(java.lang.Object _delegate)
           
 java.lang.Object _setLocal()
           
static RPTorrent create(Torrent _delegate)
           
 java.lang.Object getAdditionalProperty(java.lang.String name)
          Access to top-level properties in the torrent
 java.net.URL getAnnounceURL()
           
 TorrentAnnounceURLList getAnnounceURLList()
          get the announce list for multi-tracker torrents.
 Torrent getClone()
           
 java.lang.String getComment()
           
 java.lang.String getCreatedBy()
           
 long getCreationDate()
          UNIX epoch format in seconds
 java.lang.String getEncoding()
           
 TorrentFile[] getFiles()
           
 byte[] getHash()
           
 java.net.URL getMagnetURI()
          Gets the magnet URI for the torrent - throws exception if not available
 java.util.Map getMapProperty(java.lang.String name)
          Gets a previously set map value
 java.lang.String getName()
           
 long getPieceCount()
           
 byte[][] getPieces()
           
 long getPieceSize()
           
 java.lang.String getPluginStringProperty(java.lang.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(java.net.URL url)
           
 void setComment(java.lang.String comment)
           
 void setComplete(java.io.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(java.lang.String encoding)
           
 void setMapProperty(java.lang.String name, java.util.Map value)
          Sets a map property in the torrent, retrievable via getMapProperty
 void setPluginStringProperty(java.lang.String name, java.lang.String value)
          Set a property specific to this plugin
 void setPrivate(boolean priv)
           
 boolean wasCreatedByUs()
           
 byte[] writeToBEncodedData()
           
 void writeToFile(java.io.File file)
           
 java.util.Map writeToMap()
           
 
Methods inherited from class org.gudy.azureus2.pluginsimpl.remote.RPObject
_fixupLocal, _getDelegate, _getName, _getOID, _lookupLocal, _lookupLocal, _refresh, _setRemote, getDispatcher, notSupported, notSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected transient Torrent delegate

name

public java.lang.String name

size

public long size

hash

public byte[] hash
Constructor Detail

RPTorrent

protected RPTorrent(Torrent _delegate)
Method Detail

create

public static RPTorrent create(Torrent _delegate)

_setDelegate

protected void _setDelegate(java.lang.Object _delegate)
Overrides:
_setDelegate in class RPObject

_setLocal

public java.lang.Object _setLocal()
                           throws RPException
Overrides:
_setLocal in class RPObject
Throws:
RPException

_process

public RPReply _process(RPRequest request)
Overrides:
_process in class RPObject

getName

public java.lang.String getName()
Specified by:
getName in interface Torrent

getAnnounceURL

public java.net.URL getAnnounceURL()
Specified by:
getAnnounceURL in interface Torrent

setAnnounceURL

public void setAnnounceURL(java.net.URL url)
Specified by:
setAnnounceURL in interface Torrent

getAnnounceURLList

public TorrentAnnounceURLList getAnnounceURLList()
Description copied from interface: Torrent
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

Specified by:
getAnnounceURLList in interface Torrent
Returns:

isDecentralised

public boolean isDecentralised()
Description copied from interface: Torrent
A decentralised torrent uses the DHT only as a "tracker"

Specified by:
isDecentralised in interface Torrent
Returns:

isDecentralisedBackupEnabled

public boolean isDecentralisedBackupEnabled()
Description copied from interface: Torrent
Decentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailable

Specified by:
isDecentralisedBackupEnabled in interface Torrent
Returns:

setDecentralisedBackupRequested

public void setDecentralisedBackupRequested(boolean requested)
Description copied from interface: Torrent
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

Specified by:
setDecentralisedBackupRequested in interface Torrent

isDecentralisedBackupRequested

public boolean isDecentralisedBackupRequested()
Specified by:
isDecentralisedBackupRequested in interface Torrent

isPrivate

public boolean isPrivate()
Description copied from interface: Torrent
A private torrent is either explicitly private via info/private or has decentralised backup disabled and peer exchange disabled

Specified by:
isPrivate in interface Torrent
Returns:

wasCreatedByUs

public boolean wasCreatedByUs()
Specified by:
wasCreatedByUs in interface Torrent
Returns:

setPrivate

public void setPrivate(boolean priv)
Specified by:
setPrivate in interface Torrent

getHash

public byte[] getHash()
Specified by:
getHash in interface Torrent

getSize

public long getSize()
Description copied from interface: Torrent
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

Specified by:
getSize in interface Torrent
Returns:

getComment

public java.lang.String getComment()
Specified by:
getComment in interface Torrent

setComment

public void setComment(java.lang.String comment)
Specified by:
setComment in interface Torrent

getCreationDate

public long getCreationDate()
Description copied from interface: Torrent
UNIX epoch format in seconds

Specified by:
getCreationDate in interface Torrent

getCreatedBy

public java.lang.String getCreatedBy()
Specified by:
getCreatedBy in interface Torrent

getPieceSize

public long getPieceSize()
Specified by:
getPieceSize in interface Torrent

getPieceCount

public long getPieceCount()
Specified by:
getPieceCount in interface Torrent

getPieces

public byte[][] getPieces()
Specified by:
getPieces in interface Torrent

getMagnetURI

public java.net.URL getMagnetURI()
Description copied from interface: Torrent
Gets the magnet URI for the torrent - throws exception if not available

Specified by:
getMagnetURI in interface Torrent
Returns:

getEncoding

public java.lang.String getEncoding()
Specified by:
getEncoding in interface Torrent

setEncoding

public void setEncoding(java.lang.String encoding)
Specified by:
setEncoding in interface Torrent

setDefaultEncoding

public void setDefaultEncoding()
Specified by:
setDefaultEncoding in interface Torrent

getFiles

public TorrentFile[] getFiles()
Specified by:
getFiles in interface Torrent

getAdditionalProperty

public java.lang.Object getAdditionalProperty(java.lang.String name)
Description copied from interface: Torrent
Access to top-level properties in the torrent

Specified by:
getAdditionalProperty in interface Torrent
Returns:

removeAdditionalProperties

public Torrent removeAdditionalProperties()
Description copied from interface: Torrent
Removal all non-standard properties (excluding plugin-properties below)

Specified by:
removeAdditionalProperties in interface Torrent
Returns:

setPluginStringProperty

public void setPluginStringProperty(java.lang.String name,
                                    java.lang.String value)
Description copied from interface: Torrent
Set a property specific to this plugin

Specified by:
setPluginStringProperty in interface Torrent

getPluginStringProperty

public java.lang.String getPluginStringProperty(java.lang.String name)
Description copied from interface: Torrent
Get a property specific to this plugin

Specified by:
getPluginStringProperty in interface Torrent
Returns:

setMapProperty

public void setMapProperty(java.lang.String name,
                           java.util.Map value)
Description copied from interface: Torrent
Sets a map property in the torrent, retrievable via getMapProperty

Specified by:
setMapProperty in interface Torrent
Parameters:
name - should be unique across plugins (i.e. prefix it with something unique)
value - bencodable Map value

getMapProperty

public java.util.Map getMapProperty(java.lang.String name)
Description copied from interface: Torrent
Gets a previously set map value

Specified by:
getMapProperty in interface Torrent
Parameters:
name - should be unique across plugins (i.e. prefix it with something unique)
Returns:
See Also:
setMapProperty

writeToMap

public java.util.Map writeToMap()
                         throws TorrentException
Specified by:
writeToMap in interface Torrent
Throws:
TorrentException

writeToBEncodedData

public byte[] writeToBEncodedData()
                           throws TorrentException
Specified by:
writeToBEncodedData in interface Torrent
Throws:
TorrentException

writeToFile

public void writeToFile(java.io.File file)
                 throws TorrentException
Specified by:
writeToFile in interface Torrent
Throws:
TorrentException

save

public void save()
          throws TorrentException
Description copied from interface: Torrent
Saves the torrent to its persistent location

Specified by:
save in interface Torrent
Throws:
TorrentException

setComplete

public void setComplete(java.io.File data_dir)
                 throws TorrentException
Description copied from interface: Torrent
sets the torrent complete - i.e. ready for seeding. Doing this avoids a recheck on torrent addition

Specified by:
setComplete in interface Torrent
Throws:
TorrentException

isComplete

public boolean isComplete()
Specified by:
isComplete in interface Torrent

isSimpleTorrent

public boolean isSimpleTorrent()
Description copied from interface: Torrent
Returns true if the torrent is a single file torrent, false if it is a multi file torrent.

Specified by:
isSimpleTorrent in interface Torrent

getClone

public Torrent getClone()
                 throws TorrentException
Specified by:
getClone in interface Torrent
Throws:
TorrentException