org.gudy.azureus2.plugins.torrent
Interface TorrentManager

All Known Implementing Classes:
RPTorrentManager, TorrentManagerImpl

public interface TorrentManager


Field Summary
static int PRESERVE_ALL
          Preserve all additional Attributes value is 0xffffffff;
static int PRESERVE_ENCODING
          Preserve the encoding Attribute value is 0x00000001
static int PRESERVE_NONE
          Preserve no additional Attributes value is 0
 
Method Summary
 void addListener(TorrentManagerListener l)
           
 Torrent createFromBEncodedData(byte[] data)
          decodes a torrent encoded using the normal "bencoding" rules from a byte array
 Torrent createFromBEncodedData(byte[] data, int preserve)
          decodes a torrent encoded using the normal "bencoding" rules from a byte array
 Torrent createFromBEncodedFile(java.io.File file)
          decodes a torrent encoded using the normal "bencoding" rules from a file
 Torrent createFromBEncodedFile(java.io.File file, boolean for_seeding)
          decodes a torrent encoded using the normal "bencoding" rules from a file but discards the piece hashes to save memory.
 Torrent createFromBEncodedFile(java.io.File file, int preserve)
          decodes a torrent encoded using the normal "bencoding" rules from a file
 Torrent createFromBEncodedInputStream(java.io.InputStream data)
          decodes a torrent encoded using the normal "bencoding" rules from an InputStream
 Torrent createFromBEncodedInputStream(java.io.InputStream data, int preserve)
          decodes a torrent encoded using the normal "bencoding" rules from an InputStream
 Torrent createFromDataFile(java.io.File data, java.net.URL announce_url)
          creates a new torrent from an input file
 Torrent createFromDataFile(java.io.File data, java.net.URL announce_url, boolean include_other_hashes)
           
 TorrentCreator createFromDataFileEx(java.io.File data, java.net.URL announce_url, boolean include_other_hashes)
           
 TorrentAttribute getAttribute(java.lang.String name)
          Gives access to the standard built-in attributes
 TorrentAttribute[] getDefinedAttributes()
          Gives access to the currently defined torrent attributes.
 TorrentAttribute getPluginAttribute(java.lang.String name)
          Gives access to/creates arbitrary String attributes for plugins to use.
 TorrentDownloader getURLDownloader(java.net.URL url)
           
 TorrentDownloader getURLDownloader(java.net.URL url, java.lang.String user_name, java.lang.String password)
           
 void removeListener(TorrentManagerListener l)
           
 

Field Detail

PRESERVE_NONE

static final int PRESERVE_NONE
Preserve no additional Attributes value is 0

Since:
3009
See Also:
Constant Field Values

PRESERVE_ENCODING

static final int PRESERVE_ENCODING
Preserve the encoding Attribute value is 0x00000001

Since:
3009
See Also:
Constant Field Values

PRESERVE_ALL

static final int PRESERVE_ALL
Preserve all additional Attributes value is 0xffffffff;

Since:
3009
See Also:
Constant Field Values
Method Detail

getURLDownloader

TorrentDownloader getURLDownloader(java.net.URL url)
                                   throws TorrentException
Throws:
TorrentException

getURLDownloader

TorrentDownloader getURLDownloader(java.net.URL url,
                                   java.lang.String user_name,
                                   java.lang.String password)
                                   throws TorrentException
Throws:
TorrentException

createFromBEncodedFile

Torrent createFromBEncodedFile(java.io.File file)
                               throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from a file

Parameters:
file -
Returns:
Throws:
TorrentException

createFromBEncodedFile

Torrent createFromBEncodedFile(java.io.File file,
                               boolean for_seeding)
                               throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from a file but discards the piece hashes to save memory. note that this means that if something reads the hashes they will be re-read from the torrent file and if the file has since been deleted things go smelly

Parameters:
file -
for_seeding - reduces memory usage by discarding piece hashes
Returns:
Throws:
TorrentException

createFromBEncodedInputStream

Torrent createFromBEncodedInputStream(java.io.InputStream data)
                                      throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from an InputStream

Parameters:
file -
Returns:
Throws:
TorrentException

createFromBEncodedData

Torrent createFromBEncodedData(byte[] data)
                               throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from a byte array

Parameters:
file -
Returns:
Throws:
TorrentException

createFromBEncodedFile

Torrent createFromBEncodedFile(java.io.File file,
                               int preserve)
                               throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from a file

Parameters:
file -
preserve - PRESERVE_* flags
Returns:
Throws:
TorrentException
Since:
3009

createFromBEncodedInputStream

Torrent createFromBEncodedInputStream(java.io.InputStream data,
                                      int preserve)
                                      throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from an InputStream

Parameters:
data -
preserve - PRESERVE_* flags
Returns:
Throws:
TorrentException
Since:
3009

createFromBEncodedData

Torrent createFromBEncodedData(byte[] data,
                               int preserve)
                               throws TorrentException
decodes a torrent encoded using the normal "bencoding" rules from a byte array

Parameters:
data -
preserve - PRESERVE_* flags
Returns:
Throws:
TorrentException
Since:
3009

createFromDataFile

Torrent createFromDataFile(java.io.File data,
                           java.net.URL announce_url)
                           throws TorrentException
creates a new torrent from an input file

Parameters:
data -
Returns:
Throws:
TorrentException

createFromDataFile

Torrent createFromDataFile(java.io.File data,
                           java.net.URL announce_url,
                           boolean include_other_hashes)
                           throws TorrentException
Throws:
TorrentException

createFromDataFileEx

TorrentCreator createFromDataFileEx(java.io.File data,
                                    java.net.URL announce_url,
                                    boolean include_other_hashes)
                                    throws TorrentException
Throws:
TorrentException

getDefinedAttributes

TorrentAttribute[] getDefinedAttributes()
Gives access to the currently defined torrent attributes. As of 2.1.0.2 only "category" is defined, however in the future more could be added such as "quality", "bit rate" etc.

Returns:

getAttribute

TorrentAttribute getAttribute(java.lang.String name)
Gives access to the standard built-in attributes

Parameters:
name -
Returns:

getPluginAttribute

TorrentAttribute getPluginAttribute(java.lang.String name)
Gives access to/creates arbitrary String attributes for plugins to use. The attribute will be specific to the plugin, so you can use short torrent names like "name", you won't need to add the plugin ID or any other sort of unique identifier to the attribute name.

Parameters:
name -
Returns:

addListener

void addListener(TorrentManagerListener l)

removeListener

void removeListener(TorrentManagerListener l)