org.gudy.azureus2.plugins.utils.resourcedownloader
Interface ResourceDownloader

All Known Implementing Classes:
ResourceDownloaderAlternateImpl, ResourceDownloaderBaseImpl, ResourceDownloaderDelayedImpl, ResourceDownloaderErrorImpl, ResourceDownloaderFileImpl, ResourceDownloaderMetaRefreshImpl, ResourceDownloaderRetryImpl, ResourceDownloaderTimeoutImpl, ResourceDownloaderTorrentImpl, ResourceDownloaderURLImpl

public interface ResourceDownloader


Field Summary
static String PR_BOOLEAN_ANONYMOUS
           
static String PR_STRING_CONTENT_TYPE
           
 
Method Summary
 void addListener(ResourceDownloaderListener l)
           
 void asyncDownload()
          Asynchronously download.
 void cancel()
          Cancel the download.
 InputStream download()
          Synchronously download.
 ResourceDownloader getClone()
           
 String getName()
          Get a sensible name for the download based on its details (e.g.
 Object getProperty(String name)
          Warning! URL response properties have a type of 'List of String'
 long getSize()
          Attempts to get the size of the download.
 boolean isCancelled()
           
 void removeListener(ResourceDownloaderListener l)
           
 void reportActivity(String activity)
           
 void setProperty(String name, Object value)
           
 

Field Detail

PR_STRING_CONTENT_TYPE

static final String PR_STRING_CONTENT_TYPE
See Also:
Constant Field Values

PR_BOOLEAN_ANONYMOUS

static final String PR_BOOLEAN_ANONYMOUS
See Also:
Constant Field Values
Method Detail

getName

String getName()
Get a sensible name for the download based on its details (e.g. URL)

Returns:

download

InputStream download()
                     throws ResourceDownloaderException
Synchronously download. Events are still reported to listeners

Returns:
Throws:
ResourceDownloaderException

asyncDownload

void asyncDownload()
Asynchronously download.


getSize

long getSize()
             throws ResourceDownloaderException
Attempts to get the size of the download. Returns -1 if the size can't be determined.

Note: You must not call this method from the reportActivity callback method.

Throws:
ResourceDownloaderException

setProperty

void setProperty(String name,
                 Object value)
                 throws ResourceDownloaderException
Throws:
ResourceDownloaderException

getProperty

Object getProperty(String name)
                   throws ResourceDownloaderException
Warning! URL response properties have a type of 'List of String'

Parameters:
name -
Returns:
Throws:
ResourceDownloaderException

cancel

void cancel()
Cancel the download.


isCancelled

boolean isCancelled()

getClone

ResourceDownloader getClone()

reportActivity

void reportActivity(String activity)

addListener

void addListener(ResourceDownloaderListener l)

removeListener

void removeListener(ResourceDownloaderListener l)