public interface MPReceiver
Modifier and Type | Method and Description |
---|---|
void |
attemptFailed(java.lang.String reason,
int attemptNum,
int maxAttempts)
Called by the transfer engine to indicate a download attempt failed.
|
java.io.File |
getDestinationFile()
Returns a valid, writable file to where the MP being received should be
written.
|
void |
receiveComplete(boolean success,
java.lang.String failReason,
int attempt)
Called by the transfer engine to indicate a download is finished and
no additional attempts will be made; this is called for successful
and unsuccessful completions, indicating no additional attempts will
be made!
For failed transfers, failReason may give more info
as to why, but generally speaking the per-attempt
error detail from attemptFailed() will be more informative.
|
void |
receiveProgress(long bytesTransferred,
long totalBytesExpected,
int attemptNum,
int maxAttempts)
Called by the transfer engine to indicate progress on receiving the MP.
|
java.io.File getDestinationFile() throws java.io.IOException
java.io.IOException
- if an error occursvoid receiveProgress(long bytesTransferred, long totalBytesExpected, int attemptNum, int maxAttempts)
bytesTransferred
- total number of bytes transferred in this download attempttotalBytesExpected
- total number of bytes expected in the transfer;
0 if unknownattemptNum
- attempt number this progress is for (starting from 1)maxAttempts
- total number of attempts that may be made
(constant for any given transfer)void attemptFailed(java.lang.String reason, int attemptNum, int maxAttempts)
reason
- a description of why the transfer failed, if known, or nullattemptNum
- attempt number that failed (starting from 1)maxAttempts
- total number of attempts that will be made
(constant for any given transfer)void receiveComplete(boolean success, java.lang.String failReason, int attempt)
success
- true if the transfer was successful, false if failedfailReason
- reason why the download failed, if known, else
nullattempt
- the attempt the download completed on