org.gudy.azureus2.core3.torrentdownloader
Interface TorrentDownloader

All Known Implementing Classes:
TorrentDownloaderImpl, TorrentDownloaderLoggedImpl

public interface TorrentDownloader

Author:
Tobias Minich

Field Summary
static int STATE_CANCELLED
           
static int STATE_DOWNLOADING
           
static int STATE_DUPLICATE
           
static int STATE_ERROR
           
static int STATE_FINISHED
           
static int STATE_INIT
           
static int STATE_NON_INIT
           
static int STATE_START
           
 
Method Summary
 void cancel()
          Cancels the download.
 boolean getDeleteFileOnCancel()
           
 int getDownloadState()
          Gets the state of the TorrentDownloader.
 String getError()
          Returns the error string if one occured, "Ok" otherwise.
 File getFile()
          Returns the File the TorrentDownloader downloads to.
 byte[] getLastReadBytes()
           
 int getLastReadCount()
           
 int getPercentDone()
          Returns the amount downloaded in per cent.
 String getStatus()
           
 int getTotalRead()
          Returns the amount downloaded in bytes.
 String getURL()
          Returns the URL downloaded from.
 boolean isIgnoreReponseCode()
           
 void setDeleteFileOnCancel(boolean deleteFileOnCancel)
           
 void setDownloadPath(String path, String file)
          Changes the path and filename to download to.
 void setIgnoreReponseCode(boolean ignoreReponseCode)
           
 void start()
          Starts the download.
 

Field Detail

STATE_NON_INIT

static final int STATE_NON_INIT
See Also:
Constant Field Values

STATE_INIT

static final int STATE_INIT
See Also:
Constant Field Values

STATE_START

static final int STATE_START
See Also:
Constant Field Values

STATE_DOWNLOADING

static final int STATE_DOWNLOADING
See Also:
Constant Field Values

STATE_FINISHED

static final int STATE_FINISHED
See Also:
Constant Field Values

STATE_ERROR

static final int STATE_ERROR
See Also:
Constant Field Values

STATE_DUPLICATE

static final int STATE_DUPLICATE
See Also:
Constant Field Values

STATE_CANCELLED

static final int STATE_CANCELLED
See Also:
Constant Field Values
Method Detail

start

void start()
Starts the download.


cancel

void cancel()
Cancels the download.


setDownloadPath

void setDownloadPath(String path,
                     String file)
Changes the path and filename to download to. You can give null for either to leave it as is. (These are initialized to either the path/filename given via TorrentDownloaderFactory.download(Managed) or to the default torrent save directory (path) and the filename the server proposes (file). This function does nothing after the download has been started.

Parameters:
path - The path for download.
file - The file name for download.

getDownloadState

int getDownloadState()
Gets the state of the TorrentDownloader.


getFile

File getFile()
Returns the File the TorrentDownloader downloads to.


getPercentDone

int getPercentDone()
Returns the amount downloaded in per cent. Gives -1 if total size is not available.


getTotalRead

int getTotalRead()
Returns the amount downloaded in bytes.


getError

String getError()
Returns the error string if one occured, "Ok" otherwise.


getStatus

String getStatus()

getURL

String getURL()
Returns the URL downloaded from.


getLastReadCount

int getLastReadCount()
Returns:

getLastReadBytes

byte[] getLastReadBytes()
Returns:

getDeleteFileOnCancel

boolean getDeleteFileOnCancel()
Returns:

setDeleteFileOnCancel

void setDeleteFileOnCancel(boolean deleteFileOnCancel)
Parameters:
deleteFileOnCancel -

isIgnoreReponseCode

boolean isIgnoreReponseCode()
Returns:
Since:
4.0.0.5

setIgnoreReponseCode

void setIgnoreReponseCode(boolean ignoreReponseCode)
Parameters:
ignoreReponseCode -
Since:
4.0.0.5