Package com.biglybt.core.torrent
Interface TOTorrent
- All Known Subinterfaces:
TorrentUtils.ExtendedTorrent
- All Known Implementing Classes:
DownloadManagerStateImpl.CachedStateWrapper
,LWSTorrent
,TorrentUtils.torrentDelegate
,TOTorrentCreateImpl
,TOTorrentDeserialiseImpl
,TOTorrentImpl
,TRHostExternalTorrent
public interface TOTorrent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
These ones are *not* exportable to the worldstatic final String
A Map additional property defined for holding AZ specific properties that are deemed to be exportable to the worldstatic final String
static final String
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
byte[]
getAdditionalProperty
(String name) A torrent must have a URL that identifies the tracker.When a group of sets of trackers is defined their URLs are accessed via this methodbyte[]
Comment is an optional torrent propertybyte[]
long
Gets the creation date of the torrent.default int
For hybrid torrents this indicates whether it is acting as a v1 or v2 swarmint
getFiles()
A torrent consists of one or more files.byte[]
getFullHash
(int type) byte[]
getHash()
For a V1 or hybrid torrent this returns the SHA1 hash For a V2 only torrent it returns the truncated SHA256 hashconvenience method to get a wrapped hash for performance purposesbyte[]
getName()
Get the name of the torrentint
long
Returns the piece length used for the torrentbyte[][]
This method provides access to the SHA1/SHA256 hash values (20/32 bytes each) that correspond to the pieces of the torrent.boolean
long
getSize()
int
default byte[]
getTruncatedHash
(int type) Retrieves the utf8 name of the torrent ONLY if the torrent specified one in it's info map.boolean
hasSameHashAs
(TOTorrent other) compares two torrents by hashboolean
boolean
boolean
Is the torrent in a fit state to export and share?boolean
A "simple torrent" is one that consists of a single file on its own (i.e.boolean
void
print()
A diagnostic method for dumping the tracker contents to "stdout"void
remove all additional properties to clear out the torrentvoid
void
selectHybridHashType
(int type) void
serialiseToBEncodedFile
(File file) This method will serialise a torrent using the standard "b-encoding" mechanism into a fileThis method will serialise a torrent into a Map consistent with that used by the "b-encoding" routines defined elsewherevoid
serialiseToXMLFile
(File file) This method will serialise a torrent using an XML encoding to a filevoid
setAdditionalByteArrayProperty
(String name, byte[] value) void
setAdditionalListProperty
(String name, List value) void
setAdditionalLongProperty
(String name, Long value) void
setAdditionalMapProperty
(String name, Map value) void
setAdditionalProperty
(String name, Object value) set an arbitrary property.void
setAdditionalStringProperty
(String name, String value) The additional properties are used for holding non-core data for Azureus' own userboolean
setAnnounceURL
(URL url) void
setComment
(String comment) void
setCreatedBy
(byte[] cb) void
setCreationDate
(long date) void
setHashOverride
(byte[] hash) void
setPieces
(byte[][] pieces) This method exists to support the temporary discarding of piece hashes to conserver memory.void
setPrivate
(boolean _private) Note - changing the private attribute CHANGES THE TORRENT HASHsetSimpleTorrentDisabled
(boolean disabled) void
Note - changing the source CHANGES THE TORRENT HASHboolean
updateExportability
(TOTorrent from) Propagate exportability from another torrent to this one - has to have same hash.
-
Field Details
-
TT_V1
static final int TT_V1- See Also:
-
TT_V1_V2
static final int TT_V1_V2- See Also:
-
TT_V2
static final int TT_V2- See Also:
-
DEFAULT_IGNORE_FILES
- See Also:
-
AZUREUS_PROPERTIES
A Map additional property defined for holding AZ specific properties that are deemed to be exportable to the world- See Also:
-
AZUREUS_PRIVATE_PROPERTIES
These ones are *not* exportable to the world- See Also:
-
ENCODING_ACTUALLY_UTF8_KEYS
- See Also:
-
-
Method Details
-
getTorrentType
int getTorrentType()- Returns:
- One of the TT_ constants
-
getEffectiveTorrentType
default int getEffectiveTorrentType()For hybrid torrents this indicates whether it is acting as a v1 or v2 swarm- Returns:
-
isExportable
boolean isExportable()Is the torrent in a fit state to export and share?- Returns:
-
updateExportability
Propagate exportability from another torrent to this one - has to have same hash. Required because an internal torrent can become exportable whilst the 'saved' (unexportable) original torrent is sitting there untouched...- Parameters:
from
-- Returns:
-
getName
byte[] getName()Get the name of the torrent- Returns:
-
isSimpleTorrent
boolean isSimpleTorrent()A "simple torrent" is one that consists of a single file on its own (i.e. not in a nested directory).- Returns:
-
getComment
byte[] getComment()Comment is an optional torrent property- Returns:
-
setComment
-
getCreationDate
long getCreationDate()Gets the creation date of the torrent. Optional property, 0 returned if not set- Returns:
-
setCreationDate
void setCreationDate(long date) -
getCreatedBy
byte[] getCreatedBy() -
setCreatedBy
void setCreatedBy(byte[] cb) -
isCreated
boolean isCreated() -
getAnnounceURL
URL getAnnounceURL()A torrent must have a URL that identifies the tracker. This method returns it. However an extension to this exists to allow multiple trackers, and their backups, to be defined. See below- Returns:
-
setAnnounceURL
- Parameters:
url
-- Returns:
- true-changed; false-not changed
-
getAnnounceURLGroup
TOTorrentAnnounceURLGroup getAnnounceURLGroup()When a group of sets of trackers is defined their URLs are accessed via this method- Returns:
- the group, always present, which may have 0 members
-
isDecentralised
boolean isDecentralised() -
getPieces
This method provides access to the SHA1/SHA256 hash values (20/32 bytes each) that correspond to the pieces of the torrent.- Returns:
-
setPieces
This method exists to support the temporary discarding of piece hashes to conserver memory. It should only be used with care!- Parameters:
pieces
-- Throws:
TOTorrentException
-
getPieceLength
long getPieceLength()Returns the piece length used for the torrent- Returns:
-
getNumberOfPieces
int getNumberOfPieces() -
getSize
long getSize() -
getFileCount
int getFileCount() -
getFiles
TOTorrentFile[] getFiles()A torrent consists of one or more files. These are accessed via this method.- Returns:
-
getHash
For a V1 or hybrid torrent this returns the SHA1 hash For a V2 only torrent it returns the truncated SHA256 hash- Returns:
- Throws:
TOTorrentException
-
getHashWrapper
convenience method to get a wrapped hash for performance purposes- Returns:
- Throws:
TOTorrentException
-
getFullHash
- Returns:
- SHA1 hash for v1/hybrid torrents, SHA256 hash for hybrid/v2 torrents
- Throws:
TOTorrentException
-
getTruncatedHash
- Throws:
TOTorrentException
-
selectHybridHashType
- Throws:
TOTorrentException
-
setHashOverride
- Throws:
TOTorrentException
-
setSimpleTorrentDisabled
- Throws:
TOTorrentException
-
isSimpleTorrentDisabled
- Throws:
TOTorrentException
-
hasSameHashAs
compares two torrents by hash- Parameters:
other
-- Returns:
-
getPrivate
boolean getPrivate() -
setPrivate
Note - changing the private attribute CHANGES THE TORRENT HASH- Parameters:
_private
-- Throws:
TOTorrentException
-
setSource
Note - changing the source CHANGES THE TORRENT HASH- Parameters:
source
-- Throws:
TOTorrentException
-
getSource
String getSource() -
setAdditionalStringProperty
The additional properties are used for holding non-core data for Azureus' own user- Parameters:
name
- name of the property (e.g. "encoding")value
- value. This will be encoded with default encoding
-
getAdditionalStringProperty
-
setAdditionalByteArrayProperty
-
getAdditionalByteArrayProperty
-
setAdditionalLongProperty
-
getAdditionalLongProperty
-
setAdditionalListProperty
-
getAdditionalListProperty
-
setAdditionalMapProperty
-
getAdditionalMapProperty
-
getAdditionalProperty
-
setAdditionalProperty
set an arbitrary property. Make sure its compatible with bencoding! -
removeAdditionalProperty
-
removeAdditionalProperties
void removeAdditionalProperties()remove all additional properties to clear out the torrent -
serialiseToBEncodedFile
This method will serialise a torrent using the standard "b-encoding" mechanism into a file- Parameters:
file
-- Throws:
TOTorrentException
-
serialiseToMap
This method will serialise a torrent into a Map consistent with that used by the "b-encoding" routines defined elsewhere- Returns:
- Throws:
TOTorrentException
-
serialiseToXMLFile
This method will serialise a torrent using an XML encoding to a file- Parameters:
file
-- Throws:
TOTorrentException
-
addListener
-
removeListener
-
getMonitor
AEMonitor getMonitor() -
print
void print()A diagnostic method for dumping the tracker contents to "stdout" -
getUTF8Name
String getUTF8Name()Retrieves the utf8 name of the torrent ONLY if the torrent specified one in it's info map. Otherwise, returns null (you'll have to use getName() and decode it yourself)
-