public interface UploadProgress
HttpsFileUploader.
Note that it is perfectly possible to receive the callbacks in
this class even if the upload is failing. Therefore it is important
that the result of the upload operation, HttpsFileUploaderResult, is
always checked.
| Modifier and Type | Method and Description |
|---|---|
void |
uploadEnd(long totalSizeAll,
long msecondsUsed)
Informs that the upload operation has completed.
|
void |
uploadProgress(File file,
long totalSize,
int pct)
Informs about file upload progress for a given file or stream.
|
void |
uploadStart(int noOfItems,
long totalSizeAll)
Informs that an upload operation is about to begin.
|
void uploadStart(int noOfItems,
long totalSizeAll)
noOfFiles > 1.noOfItems - the number of files/streams that will be uploaded in this
upload operation.totalSizeAll - the total number of file bytes that will be sent
in this upload operation (the sum of the size of all files in the
upload operation). If you are uploading directly from a stream, rather
than a file, then such stream contribute with 0 bytes to this number,
since the size of the stream is not known in advance.
In other words this value cannot be trusted if there are streams among
the items being uploaded.void uploadProgress(File file, long totalSize, int pct)
The same percentage will never be reported twice. For each file being uploaded there will be between 2 (one for "0%" and one for "100%") and maximum 101 invocations of this method. There will always be a "0%" and a "100%" invocation. The "0%" invocation can effectively be interpreted as a file is about to be uploaded while the "100%" invocation can be interpreted as the the upload for that file has been completed.
Regarding multi-file uploads: Files are uploaded sequentially and in the
order they are specified in the List which is input to
upload method.
This callback is about a single of each such file upload. Therefore the
values in totalSize and pct relate only to this single
file upload and not the whole upload operation.
For very small files (below 8K) there will only be a "0%" and a "100%" invocation as such file is uploaded in a single write operation.
For streams the file argument will be null and the
totalSize argument will be -1. The reason is that for
streams, unlike files, we do not know the size in advance. For this reason
the percentage progress notification for streams is likely to be off.
file - local file currently being uploaded or null if what is
currently being uploaded is a stream, not a file.totalSize - total number of bytes to be sent in the upload (size in
bytes of the current file being uploaded). Value will be -1 for streams.pct - upload progress in percentage. Value between 0 and 100.void uploadEnd(long totalSizeAll,
long msecondsUsed)
totalSizeAll - the total number of data bytes that was sent
in this upload operation. This is the actual size of the data
that was sent. If only files are being uploaded then this number
is equal to the sum of the size of the files. Streams contribute to
this number with their actual size.msecondsUsed - number of milliseconds used on the upload
operationCopyright © 2016 Addicticks. All rights reserved.