Class TorrentImpl
java.lang.Object
com.biglybt.core.logging.LogRelation
com.biglybt.pifimpl.local.torrent.TorrentImpl
- All Implemented Interfaces:
Torrent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private LocaleUtilDecoder
private static MagnetPlugin
private PluginInterface
private TOTorrent
-
Constructor Summary
ConstructorsConstructorDescriptionTorrentImpl
(TOTorrent _torrent) TorrentImpl
(PluginInterface _pi, TOTorrent _torrent) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
decode
(byte[] data) getAdditionalProperty
(String name) Access to top-level properties in the torrentget the announce list for multi-tracker torrents.getClone()
long
UNIX epoch format in secondsprotected void
getFiles()
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()
long
byte[][]
long
Get a property specific to this pluginObject[]
Query this class for a reference to another class that it may holdA short description of what your class holds that can be printed by the loggerlong
getSize()
If size is 0 then this is an "external" torrent and we only know its hash (and name constructed from hash).boolean
boolean
A decentralised torrent uses the DHT only as a "tracker"boolean
Decentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailableboolean
boolean
A private torrent is either explicitly private via info/private or has decentralised backup disabled and peer exchange disabledboolean
Returns 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)void
save()
Saves the torrent to its persistent locationvoid
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
void
setEncoding
(String encoding) void
setMapProperty
(String name, Map value) Sets a map property in the torrent, retrievable via getMapPropertyvoid
setPluginStringProperty
(String name, String value) Set a property specific to this pluginvoid
setPrivate
(boolean priv) protected void
updated()
boolean
byte[]
void
writeToFile
(File file) Methods inherited from class com.biglybt.core.logging.LogRelation
propogatedRelationText, queryForClass
-
Field Details
-
magnet_plugin
-
pi
-
torrent
-
decoder
-
complete
private boolean complete
-
-
Constructor Details
-
TorrentImpl
-
TorrentImpl
-
-
Method Details
-
getName
-
getAnnounceURL
- Specified by:
getAnnounceURL
in interfaceTorrent
-
setAnnounceURL
- Specified by:
setAnnounceURL
in interfaceTorrent
-
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 interfaceTorrent
- Returns:
-
getTorrent
-
isDecentralised
public boolean isDecentralised()Description copied from interface:Torrent
A decentralised torrent uses the DHT only as a "tracker"- Specified by:
isDecentralised
in interfaceTorrent
- 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 interfaceTorrent
- 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 interfaceTorrent
-
isDecentralisedBackupRequested
public boolean isDecentralisedBackupRequested()- Specified by:
isDecentralisedBackupRequested
in interfaceTorrent
-
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 -
setPrivate
public void setPrivate(boolean priv) - Specified by:
setPrivate
in interfaceTorrent
-
wasCreatedByUs
public boolean wasCreatedByUs()- Specified by:
wasCreatedByUs
in interfaceTorrent
- Returns:
-
getMagnetURI
Description copied from interface:Torrent
Gets the magnet URI for the torrent - throws exception if not available- Specified by:
getMagnetURI
in interfaceTorrent
- Returns:
- Throws:
TorrentException
-
getHash
public byte[] getHash()Description copied from interface:Torrent
v1 torrent hash or truncated v2 hash if v2 only -
getFullHash
public byte[] getFullHash(int type) - Specified by:
getFullHash
in interfaceTorrent
- Returns:
- v2 torrent hash if hybrid or v2 only 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 -
getComment
- Specified by:
getComment
in interfaceTorrent
-
setComment
- Specified by:
setComment
in interfaceTorrent
-
getCreationDate
public long getCreationDate()Description copied from interface:Torrent
UNIX epoch format in seconds- Specified by:
getCreationDate
in interfaceTorrent
-
getCreatedBy
- Specified by:
getCreatedBy
in interfaceTorrent
-
getPieceSize
public long getPieceSize()- Specified by:
getPieceSize
in interfaceTorrent
-
getPieceCount
public long getPieceCount()- Specified by:
getPieceCount
in interfaceTorrent
-
getPieces
public byte[][] getPieces() -
getFiles
-
getDecoder
protected void getDecoder() -
getEncoding
- Specified by:
getEncoding
in interfaceTorrent
-
setEncoding
- Specified by:
setEncoding
in interfaceTorrent
- Throws:
TorrentEncodingException
-
setDefaultEncoding
- Specified by:
setDefaultEncoding
in interfaceTorrent
- Throws:
TorrentEncodingException
-
decode
-
getAdditionalProperty
Description copied from interface:Torrent
Access to top-level properties in the torrent- Specified by:
getAdditionalProperty
in interfaceTorrent
- Returns:
-
removeAdditionalProperties
Description copied from interface:Torrent
Removal all non-standard properties (excluding plugin-properties below)- Specified by:
removeAdditionalProperties
in interfaceTorrent
- Returns:
-
setPluginStringProperty
Description copied from interface:Torrent
Set a property specific to this plugin- Specified by:
setPluginStringProperty
in interfaceTorrent
-
getPluginStringProperty
Description copied from interface:Torrent
Get a property specific to this plugin- Specified by:
getPluginStringProperty
in interfaceTorrent
- Returns:
-
setMapProperty
Description copied from interface:Torrent
Sets a map property in the torrent, retrievable via getMapProperty- Specified by:
setMapProperty
in interfaceTorrent
- Parameters:
name
- should be unique across plugins (i.e. prefix it with something unique)value
- bencodable Map value
-
getMapProperty
Description copied from interface:Torrent
Gets a previously set map value- Specified by:
getMapProperty
in interfaceTorrent
- Parameters:
name
- should be unique across plugins (i.e. prefix it with something unique)- Returns:
- See Also:
-
writeToMap
- Specified by:
writeToMap
in interfaceTorrent
- Throws:
TorrentException
-
writeToBEncodedData
- Specified by:
writeToBEncodedData
in interfaceTorrent
- Throws:
TorrentException
-
writeToFile
- Specified by:
writeToFile
in interfaceTorrent
- Throws:
TorrentException
-
updated
protected void updated() -
save
Description copied from interface:Torrent
Saves the torrent to its persistent location- Specified by:
save
in interfaceTorrent
- Throws:
TorrentException
-
setComplete
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 interfaceTorrent
- Throws:
TorrentException
-
isComplete
public boolean isComplete()- Specified by:
isComplete
in interfaceTorrent
-
getRelationText
Description copied from class:LogRelation
A short description of what your class holds that can be printed by the logger- Overrides:
getRelationText
in classLogRelation
- Returns:
-
getQueryableInterfaces
Description copied from class:LogRelation
Query this class for a reference to another class that it may hold- Overrides:
getQueryableInterfaces
in classLogRelation
- Returns:
- If found, the class desired. Otherwise, null.
-
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 interfaceTorrent
-
getClone
- Specified by:
getClone
in interfaceTorrent
- Throws:
TorrentException
-