com.threerings.getdown.net
Interface Downloader.Observer

Enclosing class:
Downloader

public static interface Downloader.Observer

An interface used to communicate status back to an external entity. Note: these methods are all called on the download thread, so implementors must take care to only execute thread-safe code or simply pass a message to the AWT thread, for example.


Method Summary
 void downloadFailed(Resource rsrc, Exception e)
          Called if a failure occurs while checking for an update or downloading a file.
 boolean downloadProgress(int percent, long remaining)
          Called to inform the observer of ongoing progress toward completion of the overall downloading task.
 void resolvingDownloads()
          Called before the downloader begins the series of HTTP head requests to determine the size of the files it needs to download.
 

Method Detail

resolvingDownloads

void resolvingDownloads()
Called before the downloader begins the series of HTTP head requests to determine the size of the files it needs to download.


downloadProgress

boolean downloadProgress(int percent,
                         long remaining)
Called to inform the observer of ongoing progress toward completion of the overall downloading task. The caller is guaranteed to get at least one call reporting 100% completion.

Parameters:
percent - the percent completion, in terms of total file size, of the downloads.
remaining - the estimated download time remaining in seconds, or -1 if the time can not yet be determined.
Returns:
true if the download should continue, false if it should be aborted.

downloadFailed

void downloadFailed(Resource rsrc,
                    Exception e)
Called if a failure occurs while checking for an update or downloading a file.

Parameters:
rsrc - the resource that was being downloaded when the error occurred, or null if the failure occurred while resolving downloads.
e - the exception detailing the failure.


Copyright © 2013. All Rights Reserved.