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 booleanprivate LocaleUtilDecoderprivate static MagnetPluginprivate PluginInterfaceprivate TOTorrent -
Constructor Summary
ConstructorsConstructorDescriptionTorrentImpl(TOTorrent _torrent) TorrentImpl(PluginInterface _pi, TOTorrent _torrent) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringdecode(byte[] data) getAdditionalProperty(String name) Access to top-level properties in the torrentget the announce list for multi-tracker torrents.getClone()longUNIX epoch format in secondsprotected voidgetFiles()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 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 loggerlonggetSize()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) protected voidupdated()booleanbyte[]voidwriteToFile(File file) Methods inherited from class LogRelation
propogatedRelationText, queryForClass
-
Field Details
-
magnet_plugin
-
pi
-
torrent
-
decoder
-
complete
private boolean complete
-
-
Constructor Details
-
TorrentImpl
-
TorrentImpl
-
-
Method Details
-
getName
-
getAnnounceURL
- Specified by:
getAnnounceURLin interfaceTorrent
-
setAnnounceURL
- Specified by:
setAnnounceURLin interfaceTorrent
-
getAnnounceURLList
Description copied from interface:Torrentget 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:
getAnnounceURLListin interfaceTorrent- Returns:
-
getTorrent
-
isDecentralised
public boolean isDecentralised()Description copied from interface:TorrentA decentralised torrent uses the DHT only as a "tracker"- Specified by:
isDecentralisedin interfaceTorrent- Returns:
-
isDecentralisedBackupEnabled
public boolean isDecentralisedBackupEnabled()Description copied from interface:TorrentDecentralised backup permits the DHT to be used as a tracker when the "real" tracker is unavailable- Specified by:
isDecentralisedBackupEnabledin interfaceTorrent- Returns:
-
setDecentralisedBackupRequested
public void setDecentralisedBackupRequested(boolean requested) Description copied from interface:TorrentBy 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:
setDecentralisedBackupRequestedin interfaceTorrent- Parameters:
requested-
-
isDecentralisedBackupRequested
public boolean isDecentralisedBackupRequested()- Specified by:
isDecentralisedBackupRequestedin interfaceTorrent
-
isPrivate
-
setPrivate
public void setPrivate(boolean priv) - Specified by:
setPrivatein interfaceTorrent
-
wasCreatedByUs
public boolean wasCreatedByUs()- Specified by:
wasCreatedByUsin interfaceTorrent- Returns:
-
getMagnetURI
Description copied from interface:TorrentGets the magnet URI for the torrent - throws exception if not available- Specified by:
getMagnetURIin interfaceTorrent- Returns:
- Throws:
TorrentException
-
getHash
-
getFullHash
public byte[] getFullHash(int type) - Specified by:
getFullHashin interfaceTorrent- Returns:
- v2 torrent hash if hybrid or v2 only torrent
-
getSize
-
getComment
- Specified by:
getCommentin interfaceTorrent
-
setComment
- Specified by:
setCommentin interfaceTorrent
-
getCreationDate
public long getCreationDate()Description copied from interface:TorrentUNIX epoch format in seconds- Specified by:
getCreationDatein interfaceTorrent
-
getCreatedBy
- Specified by:
getCreatedByin interfaceTorrent
-
getPieceSize
public long getPieceSize()- Specified by:
getPieceSizein interfaceTorrent
-
getPieceCount
public long getPieceCount()- Specified by:
getPieceCountin interfaceTorrent
-
getPieces
-
getFiles
-
getDecoder
protected void getDecoder() -
getEncoding
- Specified by:
getEncodingin interfaceTorrent
-
setEncoding
- Specified by:
setEncodingin interfaceTorrent- Throws:
TorrentEncodingException
-
setDefaultEncoding
- Specified by:
setDefaultEncodingin interfaceTorrent- Throws:
TorrentEncodingException
-
decode
-
getAdditionalProperty
Description copied from interface:TorrentAccess to top-level properties in the torrent- Specified by:
getAdditionalPropertyin interfaceTorrent- Parameters:
name-- Returns:
-
removeAdditionalProperties
Description copied from interface:TorrentRemoval all non-standard properties (excluding plugin-properties below)- Specified by:
removeAdditionalPropertiesin interfaceTorrent- Returns:
-
setPluginStringProperty
Description copied from interface:TorrentSet a property specific to this plugin- Specified by:
setPluginStringPropertyin interfaceTorrent- Parameters:
name-value-
-
getPluginStringProperty
Description copied from interface:TorrentGet a property specific to this plugin- Specified by:
getPluginStringPropertyin interfaceTorrent- Parameters:
name-- Returns:
-
setMapProperty
Description copied from interface:TorrentSets a map property in the torrent, retrievable via getMapProperty- Specified by:
setMapPropertyin interfaceTorrent- Parameters:
name- should be unique across plugins (i.e. prefix it with something unique)value- bencodable Map value
-
getMapProperty
Description copied from interface:TorrentGets a previously set map value- Specified by:
getMapPropertyin interfaceTorrent- Parameters:
name- should be unique across plugins (i.e. prefix it with something unique)- Returns:
- See Also:
-
writeToMap
- Specified by:
writeToMapin interfaceTorrent- Throws:
TorrentException
-
writeToBEncodedData
- Specified by:
writeToBEncodedDatain interfaceTorrent- Throws:
TorrentException
-
writeToFile
- Specified by:
writeToFilein interfaceTorrent- Throws:
TorrentException
-
updated
protected void updated() -
save
Description copied from interface:TorrentSaves the torrent to its persistent location- Specified by:
savein interfaceTorrent- Throws:
TorrentException
-
setComplete
Description copied from interface:Torrentsets the torrent complete - i.e. ready for seeding. Doing this avoids a recheck on torrent addition- Specified by:
setCompletein interfaceTorrent- Parameters:
data_dir-- Throws:
TorrentException
-
isComplete
public boolean isComplete()- Specified by:
isCompletein interfaceTorrent
-
getRelationText
Description copied from class:LogRelationA short description of what your class holds that can be printed by the logger- Overrides:
getRelationTextin classLogRelation- Returns:
-
getQueryableInterfaces
Description copied from class:LogRelationQuery this class for a reference to another class that it may hold- Overrides:
getQueryableInterfacesin classLogRelation- Returns:
- If found, the class desired. Otherwise, null.
-
isSimpleTorrent
public boolean isSimpleTorrent()Description copied from interface:TorrentReturns true if the torrent is a single file torrent, false if it is a multi file torrent.- Specified by:
isSimpleTorrentin interfaceTorrent
-
getClone
- Specified by:
getClonein interfaceTorrent- Throws:
TorrentException
-