com.threerings.getdown.net
Class Downloader
java.lang.Object
java.lang.Thread
com.threerings.getdown.net.Downloader
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- HTTPDownloader
public abstract class Downloader
- extends Thread
Handles the download of a collection of files, first issuing HTTP head requests to obtain size
information and then downloading the files individually, reporting progress back via a callback
interface.
|
Nested Class Summary |
static interface |
Downloader.Observer
An interface used to communicate status back to an external entity. |
|
Method Summary |
boolean |
download()
Start downloading the resources in this downloader. |
void |
run()
This method is invoked as the downloader thread and performs the actual downloading. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Downloader
public Downloader(List<Resource> resources,
Downloader.Observer obs)
- Creates a downloader that will download the supplied list of resources and communicate with
the specified observer. The
download() method must be called on the downloader to
initiate the download process.
run
public void run()
- This method is invoked as the downloader thread and performs the actual downloading.
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
download
public boolean download()
- Start downloading the resources in this downloader.
- Returns:
- true if the download completed or failed for unexpected reasons (in which case the
observer will have been notified), false if it was aborted by the observer.
Copyright © 2013. All Rights Reserved.