FileDocCategorySizeDatePackage
TOTorrent.javaAPI DocAzureus 3.0.3.46460Mon Sep 11 08:40:34 BST 2006org.gudy.azureus2.core3.torrent

TOTorrent

public interface TOTorrent

Fields Summary
public static final String
DEFAULT_IGNORE_FILES
public static final String
AZUREUS_PROPERTIES
A Map additional property defined for holding AZ specific properties that are deemed to be exportable to the world
Constructors Summary
Methods Summary
public byte[]getAdditionalByteArrayProperty(java.lang.String name)

public java.util.ListgetAdditionalListProperty(java.lang.String name)

public java.lang.LonggetAdditionalLongProperty(java.lang.String name)

public java.util.MapgetAdditionalMapProperty(java.lang.String name)

public java.lang.ObjectgetAdditionalProperty(java.lang.String name)

public java.lang.StringgetAdditionalStringProperty(java.lang.String name)

public java.net.URLgetAnnounceURL()
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

return

public TOTorrentAnnounceURLGroupgetAnnounceURLGroup()
When a group of sets of trackers is defined their URLs are accessed via this method

return
the group, always present, which may have 0 members

public byte[]getComment()
Comment is an optional torrent property

return

public byte[]getCreatedBy()

public longgetCreationDate()
Gets the creation date of the torrent. Optional property, 0 returned if not set

return

public TOTorrentFile[]getFiles()
A torrent consists of one or more files. These are accessed via this method.

return

public byte[]getHash()
A torrent has a unique SHA1 (20 byte) hash that is computed from some of its contents. It is used, for example, when contacting a tracker to identify the torrent.

return
throws
TOTorrentException

public HashWrappergetHashWrapper()
convenience method to get a wrapped hash for performance purposes

return
throws
TOTorrentException

public AEMonitorgetMonitor()

public byte[]getName()
Get the name of the torrent

return

public intgetNumberOfPieces()

public longgetPieceLength()
Returns the piece length used for the torrent

return

public byte[][]getPieces()
This method provides access to the SHA1 hash values (20 bytes each) that correspond to the pieces of the torrent.

return
exception
can fail if re-reading of piece hashes for space spacing fails

public booleangetPrivate()

public longgetSize()

public booleanhasSameHashAs(org.gudy.azureus2.core3.torrent.TOTorrent other)
compares two torrents by hash

param
other
return

public booleanisCreated()

public booleanisSimpleTorrent()
A "simple torrent" is one that consists of a single file on its own (i.e. not in a nested directory).

return

public voidprint()
A diagnostic method for dumping the tracker contents to "stdout"

public voidremoveAdditionalProperties()
remove all additional properties to clear out the torrent

public voidremoveAdditionalProperty(java.lang.String name)

public voidserialiseToBEncodedFile(java.io.File file)
This method will serialise a torrent using the standard "b-encoding" mechanism into a file

param
file
throws
TOTorrentException

public java.util.MapserialiseToMap()
This method will serialise a torrent into a Map consistent with that used by the "b-encoding" routines defined elsewhere

return
throws
TOTorrentException

public voidserialiseToXMLFile(java.io.File file)
This method will serialise a torrent using an XML encoding to a file

param
file
throws
TOTorrentException

public voidsetAdditionalByteArrayProperty(java.lang.String name, byte[] value)

public voidsetAdditionalListProperty(java.lang.String name, java.util.List value)

public voidsetAdditionalLongProperty(java.lang.String name, java.lang.Long value)

public voidsetAdditionalMapProperty(java.lang.String name, java.util.Map value)

public voidsetAdditionalProperty(java.lang.String name, java.lang.Object value)
set an arbitrary property. Make sure its compatible with bencoding!

public voidsetAdditionalStringProperty(java.lang.String name, java.lang.String value)
The additional properties are used for holding non-core data for Azureus' own user

param
name name of the property (e.g. "encoding")
param
value value. This will be encoded with default encoding

public booleansetAnnounceURL(java.net.URL url)

param
url
return
true-changed; false-not changed

public voidsetComment(java.lang.String comment)

public voidsetCreationDate(long date)

public voidsetPieces(byte[][] pieces)
This method exists to support the temporary discarding of piece hashes to conserver memory. It should only be used with care!

param
pieces

public voidsetPrivate(boolean _private)
Note - changing the private attribute CHANGES THE TORRENT HASH

param
_private