Package io.milton.httpclient
Interface ProgressListener
public interface ProgressListener
Use this for three purposes
a. implement a bandwidth throttle by putting a delay in onRead
b. display progress information to the user in onProgress and onComplete
c. allow the user to cancel transfers by implementing isCancelled
- Author:
- bradm
-
Method Summary
Modifier and TypeMethodDescriptionbooleanThis is a means for the UI to inform that process that the user has cancelled the optioation If the implementation returns true the operation will abortvoidonComplete(String fileName) Called on completionvoidonProgress(long bytesRead, Long totalBytes, String fileName) Called occasionally, after a reasonable period has passed so is suitable for GUI updatesvoidonRead(int bytes) Called on every read operation.
-
Method Details
-
onRead
void onRead(int bytes) Called on every read operation. If you implement any logic in here is must be fast!- Parameters:
bytes- - the number of bytes read
-
onProgress
Called occasionally, after a reasonable period has passed so is suitable for GUI updates- Parameters:
bytesRead-totalBytes- - is null if unknownfileName- - name of the file being transferred
-
onComplete
Called on completion- Parameters:
fileName-
-
isCancelled
boolean isCancelled()This is a means for the UI to inform that process that the user has cancelled the optioation If the implementation returns true the operation will abort- Returns:
-