|
27 | 27 |
|
28 | 28 | /**
|
29 | 29 | * A ProgressMonitor is a functional interface which can be passed to unirest for the purposes of
|
30 |
| - * monitoring file uploads. A common use case is for drawing upload progress bars. |
31 |
| - * If the upload contains multiple files each one is called individually and the file name is provided. |
| 30 | + * monitoring file uploads and downloads. A common use case is for drawing progress bars. |
| 31 | + * |
| 32 | + * If an upload contains multiple files each one is called individually and the file name is provided. |
32 | 33 | *
|
33 | 34 | * note that you will not receive a total for ALL files together at once.
|
34 |
| - * If you wanted this you could keep track of the total bytes of files you planned to upload and then |
| 35 | + * If you wanted this you can keep track of the total bytes of files you planned to upload and then |
35 | 36 | * have your ProgressMonitor aggregate the results.
|
36 | 37 | */
|
37 | 38 | @FunctionalInterface
|
38 | 39 | public interface ProgressMonitor {
|
39 | 40 | /**
|
40 | 41 | * Accept stats about the current file upload chunk for a file.
|
41 |
| - * @param field the field name |
| 42 | + * @param field the field name, or 'body' on file downloads |
42 | 43 | * @param fileName the name of the file in question if available (InputStreams and byte arrays may not have file names)
|
43 |
| - * @param bytesWritten the number of bytes that have been uploaded so far |
44 |
| - * @param totalBytes the total bytes that will be uploaded. Note this this may be an estimate if an InputStream was used |
| 44 | + * @param bytesWritten the number of bytes that have been uploaded or downloaded so far |
| 45 | + * @param totalBytes the total bytes that will be uploaded or downloaded. |
| 46 | + * On downloads this depends on the Content-Length header be returned |
| 47 | + * On uploads this this may be an estimate if an InputStream was used |
45 | 48 | * */
|
46 | 49 | void accept(String field, String fileName, Long bytesWritten, Long totalBytes);
|
47 | 50 | }
|
0 commit comments