|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface Files.DownloadListener
Watches a download of a file or URL many times as more and more bytes are downloaded.
During the download, those bytes can be accessed by an InputStream.
After the download, all the bytes are returned as a byte[] array.
Specifies when updates should be given and what to do when the download ends correctly or in error.
Specifies how long to wait in total and after each incremental download, before ending in error.
NEED TO ADD InputStream parameters parallel to String fileNameOrURL.
Or move that to a different interface?
Method Summary | |
---|---|
void |
done(java.lang.String fileNameOrURL,
byte[] bytes)
when the download is done, all the bytes are returned, for efficiency it should be the same byte[] array from the InputStream in update() |
void |
downloadStarted(java.lang.String fileNameOrURL,
int endSize,
long startTime)
the connection is made, but no bytes downloaded yet |
void |
failed(java.lang.String fileNameOrURL,
java.lang.Throwable error)
if the download ends with some error |
long |
minimumUpdateIncrementInMilliseconds()
update() will not be called if its too soon after the last update() |
long |
timeOutAll()
end the download if whole download not done in this many milliseconds |
long |
timeOutIncrement()
end the download if download some bytes, but not download any more bytes for this many milliseconds |
void |
update(java.lang.String fileNameOrURL,
java.io.InputStream bytes,
int endSize,
long timeSoFar)
update() is called when updateIncrementInBytes more bytes are downloaded, but not if minimumUpdateIncrementInMilliseconds time has not yet elapsed. |
int |
updateIncrementInBytes()
downloader should call update() when this many more bytes have been downloaded since the last update() or downloadStarted() |
Method Detail |
---|
long timeOutIncrement()
long timeOutAll()
int updateIncrementInBytes()
long minimumUpdateIncrementInMilliseconds()
void downloadStarted(java.lang.String fileNameOrURL, int endSize, long startTime)
void update(java.lang.String fileNameOrURL, java.io.InputStream bytes, int endSize, long timeSoFar)
void done(java.lang.String fileNameOrURL, byte[] bytes)
void failed(java.lang.String fileNameOrURL, java.lang.Throwable error)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |