Class TorrentDownloaderFactory.TorrentDownloadRetrier
- java.lang.Object
-
- com.biglybt.core.torrentdownloader.TorrentDownloaderFactory.TorrentDownloadRetrier
-
- All Implemented Interfaces:
TorrentDownloader
- Enclosing class:
- TorrentDownloaderFactory
private static class TorrentDownloaderFactory.TorrentDownloadRetrier extends java.lang.Object implements TorrentDownloader
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
cancelled
private TorrentDownloaderImpl
delegate
private boolean
dfoc
private boolean
dfoc_set
private java.lang.String
fileordir
private boolean
irc
private boolean
irc_set
private java.lang.String
original_error
private java.lang.String
referrer
private java.util.Map
request_properties
private java.lang.String
sdp_file
private java.lang.String
sdp_path
private boolean
sdp_set
private java.lang.String
url
-
Fields inherited from interface com.biglybt.core.torrentdownloader.TorrentDownloader
STATE_CANCELLED, STATE_DOWNLOADING, STATE_DUPLICATE, STATE_ERROR, STATE_FINISHED, STATE_INIT, STATE_NON_INIT, STATE_START
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TorrentDownloadRetrier(TorrentDownloaderCallBackInterface _callback, java.lang.String _url, java.lang.String _referrer, java.util.Map _request_properties, java.lang.String _fileordir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels the download.boolean
getDeleteFileOnCancel()
int
getDownloadState()
Gets the state of the TorrentDownloader.java.lang.String
getError()
Returns the error string if one occured, "Ok" otherwise.java.io.File
getFile()
Returns theFile
the TorrentDownloader downloads to.byte[]
getLastReadBytes()
int
getLastReadCount()
int
getPercentDone()
Returns the amount downloaded in per cent.java.lang.String
getStatus()
int
getTotalRead()
Returns the amount downloaded in bytes.java.lang.String
getURL()
Returns the URL downloaded from.boolean
isIgnoreReponseCode()
void
setDeleteFileOnCancel(boolean deleteFileOnCancel)
void
setDownloadPath(java.lang.String path, java.lang.String file)
Changes the path and filename to download to.void
setIgnoreReponseCode(boolean ignoreReponseCode)
void
start()
Starts the download.
-
-
-
Field Detail
-
url
private final java.lang.String url
-
referrer
private final java.lang.String referrer
-
request_properties
private final java.util.Map request_properties
-
fileordir
private final java.lang.String fileordir
-
delegate
private volatile TorrentDownloaderImpl delegate
-
cancelled
private volatile boolean cancelled
-
sdp_set
private volatile boolean sdp_set
-
sdp_path
private volatile java.lang.String sdp_path
-
sdp_file
private volatile java.lang.String sdp_file
-
dfoc_set
private volatile boolean dfoc_set
-
dfoc
private volatile boolean dfoc
-
irc_set
private volatile boolean irc_set
-
irc
private volatile boolean irc
-
original_error
private volatile java.lang.String original_error
-
-
Constructor Detail
-
TorrentDownloadRetrier
private TorrentDownloadRetrier(TorrentDownloaderCallBackInterface _callback, java.lang.String _url, java.lang.String _referrer, java.util.Map _request_properties, java.lang.String _fileordir)
-
-
Method Detail
-
start
public void start()
Description copied from interface:TorrentDownloader
Starts the download.- Specified by:
start
in interfaceTorrentDownloader
-
cancel
public void cancel()
Description copied from interface:TorrentDownloader
Cancels the download.- Specified by:
cancel
in interfaceTorrentDownloader
-
setDownloadPath
public void setDownloadPath(java.lang.String path, java.lang.String file)
Description copied from interface:TorrentDownloader
Changes the path and filename to download to. You can givenull
for either to leave it as is. (These are initialized to either the path/filename given viaTorrentDownloaderFactory.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.- Specified by:
setDownloadPath
in interfaceTorrentDownloader
- Parameters:
path
- The path for download.file
- The file name for download.
-
getDownloadState
public int getDownloadState()
Description copied from interface:TorrentDownloader
Gets the state of the TorrentDownloader.- Specified by:
getDownloadState
in interfaceTorrentDownloader
-
getFile
public java.io.File getFile()
Description copied from interface:TorrentDownloader
Returns theFile
the TorrentDownloader downloads to.- Specified by:
getFile
in interfaceTorrentDownloader
-
getPercentDone
public int getPercentDone()
Description copied from interface:TorrentDownloader
Returns the amount downloaded in per cent. Gives -1 if total size is not available.- Specified by:
getPercentDone
in interfaceTorrentDownloader
-
getTotalRead
public int getTotalRead()
Description copied from interface:TorrentDownloader
Returns the amount downloaded in bytes.- Specified by:
getTotalRead
in interfaceTorrentDownloader
-
getError
public java.lang.String getError()
Description copied from interface:TorrentDownloader
Returns the error string if one occured, "Ok" otherwise.- Specified by:
getError
in interfaceTorrentDownloader
-
getStatus
public java.lang.String getStatus()
- Specified by:
getStatus
in interfaceTorrentDownloader
-
getURL
public java.lang.String getURL()
Description copied from interface:TorrentDownloader
Returns the URL downloaded from.- Specified by:
getURL
in interfaceTorrentDownloader
-
getLastReadCount
public int getLastReadCount()
- Specified by:
getLastReadCount
in interfaceTorrentDownloader
- Returns:
-
getLastReadBytes
public byte[] getLastReadBytes()
- Specified by:
getLastReadBytes
in interfaceTorrentDownloader
- Returns:
-
getDeleteFileOnCancel
public boolean getDeleteFileOnCancel()
- Specified by:
getDeleteFileOnCancel
in interfaceTorrentDownloader
- Returns:
-
setDeleteFileOnCancel
public void setDeleteFileOnCancel(boolean deleteFileOnCancel)
- Specified by:
setDeleteFileOnCancel
in interfaceTorrentDownloader
-
isIgnoreReponseCode
public boolean isIgnoreReponseCode()
- Specified by:
isIgnoreReponseCode
in interfaceTorrentDownloader
- Returns:
-
setIgnoreReponseCode
public void setIgnoreReponseCode(boolean ignoreReponseCode)
- Specified by:
setIgnoreReponseCode
in interfaceTorrentDownloader
-
-