Class TorrentDownloaderImpl
java.lang.Object
java.lang.Thread
com.biglybt.core.util.AEThread
com.biglybt.core.torrentdownloader.impl.TorrentDownloaderImpl
- All Implemented Interfaces:
TorrentDownloader, Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private intprivate booleanprivate URLConnectionprivate booleanprivate Stringprivate intprivate Stringprivate Fileprivate Stringprivate Stringprivate booleanprivate Stringprivate intprivate Proxyprivate intprivate Stringprivate Mapprivate intprivate String(package private) final AEMonitorprivate static final AtomicLongprivate URLprivate StringFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYFields inherited from interface TorrentDownloader
STATE_CANCELLED, STATE_DOWNLOADING, STATE_DUPLICATE, STATE_ERROR, STATE_FINISHED, STATE_INIT, STATE_NON_INIT, STATE_START -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the download.private voidprotected voidbooleanprivate voidbooleanintGets the state of the TorrentDownloader.getError()Returns the error string if one occured, "Ok" otherwise.intgetFile()Returns theFilethe TorrentDownloader downloads to.byte[]intintReturns the amount downloaded in per cent.intReturns the amount downloaded in bytes.getURL()Returns the URL downloaded from.inthashCode()voidinit(TorrentDownloaderCallBackInterface _iface, String _url, Proxy _proxy, String _referrer, Map _request_properties, String _file) booleanvoidvoidvoidsetDeleteFileOnCancel(boolean deleteFileOnCancel) voidsetDownloadPath(String path, String file) Changes the path and filename to download to.voidsetDownloadState(int state) voidvoidsetIgnoreReponseCode(boolean ignoreReponseCode) protected voidMethods inherited from class AEThread
isOurThread, run, setOurThread, setOurThreadMethods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yieldMethods inherited from interface TorrentDownloader
start
-
Field Details
-
uid
-
original_url
-
url_str
-
proxy
-
referrer
-
request_properties
-
file_str
-
url
-
con
-
error
-
status
-
iface
-
state
private int state -
percentDone
private int percentDone -
readTotal
private int readTotal -
cancel
private boolean cancel -
filename
-
directoryname
-
file
-
buf
private final byte[] buf -
bufBytes
private int bufBytes -
deleteFileOnCancel
private boolean deleteFileOnCancel -
ignoreReponseCode
private boolean ignoreReponseCode -
this_mon
-
errCode
private int errCode
-
-
Constructor Details
-
TorrentDownloaderImpl
public TorrentDownloaderImpl()
-
-
Method Details
-
init
-
notifyListener
public void notifyListener() -
cleanUpFile
private void cleanUpFile() -
error
-
runSupport
public void runSupport()- Specified by:
runSupportin classAEThread
-
equals
-
hashCode
-
getError
Description copied from interface:TorrentDownloaderReturns the error string if one occured, "Ok" otherwise.- Specified by:
getErrorin interfaceTorrentDownloader
-
setError
-
getErrorCode
public int getErrorCode() -
setStatus
-
getStatus
- Specified by:
getStatusin interfaceTorrentDownloader
-
getFile
Description copied from interface:TorrentDownloaderReturns theFilethe TorrentDownloader downloads to.- Specified by:
getFilein interfaceTorrentDownloader
-
getPercentDone
public int getPercentDone()Description copied from interface:TorrentDownloaderReturns the amount downloaded in per cent. Gives -1 if total size is not available.- Specified by:
getPercentDonein interfaceTorrentDownloader
-
getDownloadState
public int getDownloadState()Description copied from interface:TorrentDownloaderGets the state of the TorrentDownloader.- Specified by:
getDownloadStatein interfaceTorrentDownloader
-
setDownloadState
public void setDownloadState(int state) -
getURL
Description copied from interface:TorrentDownloaderReturns the URL downloaded from.- Specified by:
getURLin interfaceTorrentDownloader
-
cancel
public void cancel()Description copied from interface:TorrentDownloaderCancels the download.- Specified by:
cancelin interfaceTorrentDownloader
-
closeConnection
protected void closeConnection() -
setDownloadPath
Description copied from interface:TorrentDownloaderChanges the path and filename to download to. You can givenullfor 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:
setDownloadPathin interfaceTorrentDownloader- Parameters:
path- The path for download.file- The file name for download.
-
getTotalRead
public int getTotalRead()Description copied from interface:TorrentDownloaderReturns the amount downloaded in bytes.- Specified by:
getTotalReadin interfaceTorrentDownloader
-
getLastReadBytes
public byte[] getLastReadBytes()- Specified by:
getLastReadBytesin interfaceTorrentDownloader- Returns:
-
getLastReadCount
public int getLastReadCount()- Specified by:
getLastReadCountin interfaceTorrentDownloader- Returns:
-
setDeleteFileOnCancel
public void setDeleteFileOnCancel(boolean deleteFileOnCancel) - Specified by:
setDeleteFileOnCancelin interfaceTorrentDownloader- Parameters:
deleteFileOnCancel-
-
getDeleteFileOnCancel
public boolean getDeleteFileOnCancel()- Specified by:
getDeleteFileOnCancelin interfaceTorrentDownloader- Returns:
-
isIgnoreReponseCode
public boolean isIgnoreReponseCode()- Specified by:
isIgnoreReponseCodein interfaceTorrentDownloader- Returns:
-
setIgnoreReponseCode
public void setIgnoreReponseCode(boolean ignoreReponseCode) - Specified by:
setIgnoreReponseCodein interfaceTorrentDownloader- Parameters:
ignoreReponseCode-
-