Class RPTorrent

java.lang.Object
com.biglybt.pifimpl.remote.RPObject
com.biglybt.pifimpl.remote.torrent.RPTorrent
All Implemented Interfaces:
Torrent, Serializable

public class RPTorrent extends RPObject implements Torrent
See Also:
  • Field Details

    • delegate

      protected transient Torrent delegate
    • name

      public String name
    • size

      public long size
    • hash

      public byte[] hash
  • Constructor Details

    • RPTorrent

      protected RPTorrent(Torrent _delegate)
  • Method Details

    • create

      public static RPTorrent create(Torrent _delegate)
    • _setDelegate

      protected void _setDelegate(Object _delegate)
      Overrides:
      _setDelegate in class RPObject
    • _setLocal

      public Object _setLocal() throws RPException
      Overrides:
      _setLocal in class RPObject
      Throws:
      RPException
    • _process

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

      public String getName()
      Specified by:
      getName in interface Torrent
    • getAnnounceURL

      public URL getAnnounceURL()
      Specified by:
      getAnnounceURL in interface Torrent
    • setAnnounceURL

      public void setAnnounceURL(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
      Parameters:
      requested -
    • 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()
      Description copied from interface: Torrent
      v1 torrent hash or truncated v2 hash if v2 only
      Specified by:
      getHash in interface Torrent
      Returns:
    • 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 String getComment()
      Specified by:
      getComment in interface Torrent
    • setComment

      public void setComment(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 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 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 String getEncoding()
      Specified by:
      getEncoding in interface Torrent
    • setEncoding

      public void setEncoding(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 Object getAdditionalProperty(String name)
      Description copied from interface: Torrent
      Access to top-level properties in the torrent
      Specified by:
      getAdditionalProperty in interface Torrent
      Parameters:
      name -
      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(String name, String value)
      Description copied from interface: Torrent
      Set a property specific to this plugin
      Specified by:
      setPluginStringProperty in interface Torrent
      Parameters:
      name -
      value -
    • getPluginStringProperty

      public String getPluginStringProperty(String name)
      Description copied from interface: Torrent
      Get a property specific to this plugin
      Specified by:
      getPluginStringProperty in interface Torrent
      Parameters:
      name -
      Returns:
    • setMapProperty

      public void setMapProperty(String name, 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 Map getMapProperty(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:
    • writeToMap

      public 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(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(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
      Parameters:
      data_dir -
      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