Class ResourceDownloaderTimeoutImpl
java.lang.Object
com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderTimeoutImpl
- All Implemented Interfaces:
ResourceDownloader
,ResourceDownloaderListener
public class ResourceDownloaderTimeoutImpl
extends ResourceDownloaderBaseImpl
implements ResourceDownloaderListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected ResourceDownloaderBaseImpl
protected ResourceDownloaderBaseImpl
protected AESemaphore
protected Object
protected long
protected int
Fields inherited from class com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
this_mon
Fields inherited from interface com.biglybt.pif.utils.resourcedownloader.ResourceDownloader
PR_BOOLEAN_ANONYMOUS, PR_STRING_CONTENT_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionResourceDownloaderTimeoutImpl
(ResourceDownloaderBaseImpl _parent, ResourceDownloader _delegate, int _timeout_millis) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Asynchronously download.void
void
cancel()
Cancel the download.protected void
cancel
(ResourceDownloaderException reason) boolean
completed
(ResourceDownloader downloader, InputStream data) download()
Synchronously download.void
failed
(ResourceDownloader downloader, ResourceDownloaderException e) getClone
(ResourceDownloaderBaseImpl parent) getName()
Get a sensible name for the download based on its details (e.g.long
getSize()
Attempts to get the size of the download.protected long
void
setProperty
(String name, Object value) protected void
setSize
(long l) Methods inherited from class com.biglybt.pifimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
addChild, addListener, addReportListener, getBooleanProperty, getBooleanProperty, getChildren, getClone, getLCKeyProperties, getLogIndent, getLongProperty, getParent, getProperty, getProperty, getPropertySupport, getStringProperty, getStringPropertySupport, informActivity, informAmountComplete, informComplete, informFailed, informPercentDone, isAnonymous, isCancelled, removeChild, removeListener, reportActivity, reportActivity, reportAmountComplete, reportPercentComplete, setCancelled, setParent, setProperties, setPropertiesSet, setPropertyRecursive, setPropertySupport
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.pif.utils.resourcedownloader.ResourceDownloaderListener
reportActivity, reportAmountComplete, reportPercentComplete
-
Field Details
-
delegate
-
timeout_millis
protected int timeout_millis -
cancelled
protected boolean cancelled -
current_downloader
-
result
-
done_sem
-
size
protected long size
-
-
Constructor Details
-
ResourceDownloaderTimeoutImpl
public ResourceDownloaderTimeoutImpl(ResourceDownloaderBaseImpl _parent, ResourceDownloader _delegate, int _timeout_millis)
-
-
Method Details
-
getName
Description copied from interface:ResourceDownloader
Get a sensible name for the download based on its details (e.g. URL)- Specified by:
getName
in interfaceResourceDownloader
- Returns:
-
getSize
Description copied from interface:ResourceDownloader
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.
- Specified by:
getSize
in interfaceResourceDownloader
- Throws:
ResourceDownloaderException
-
setSize
protected void setSize(long l) - Specified by:
setSize
in classResourceDownloaderBaseImpl
-
setProperty
- Specified by:
setProperty
in interfaceResourceDownloader
- Throws:
ResourceDownloaderException
-
getClone
- Specified by:
getClone
in classResourceDownloaderBaseImpl
-
download
Description copied from interface:ResourceDownloader
Synchronously download. Events are still reported to listeners- Specified by:
download
in interfaceResourceDownloader
- Returns:
- Throws:
ResourceDownloaderException
-
asyncDownload
public void asyncDownload()Description copied from interface:ResourceDownloader
Asynchronously download.- Specified by:
asyncDownload
in interfaceResourceDownloader
-
getSizeSupport
- Throws:
ResourceDownloaderException
-
asyncGetSize
public void asyncGetSize() -
cancel
public void cancel()Description copied from interface:ResourceDownloader
Cancel the download.- Specified by:
cancel
in interfaceResourceDownloader
-
cancel
-
completed
- Specified by:
completed
in interfaceResourceDownloaderListener
- Parameters:
downloader
-data
-- Returns:
- return true if the completed download is OK. If false is returned then if there are alternative download sources they will be tried. If there are no other sources then the download will be "failed"
-
failed
- Specified by:
failed
in interfaceResourceDownloaderListener
-