| java.lang.Object | |
| ↳ | com.pspdfkit.document.download.DownloadJob |
A task that can download a PDF document from a DownloadSource. You can create and start a job using startDownload(DownloadRequest). To
monitor the download progress you can either set a listener using setProgressListener(ProgressListener) or retrieve a progress observable using
getProgress().
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| interface | DownloadJob.ProgressListener | Definition of callback objects for observing downloads. | |||||||||
| class | DownloadJob.ProgressListenerAdapter | An empty implementation of a DownloadJob.ProgressListener. |
|||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
cancel()
Cancel the running download.
| ||||||||||
| File |
getOutputFile()
Returns the output file as defined by the started
DownloadRequest. | ||||||||||
| Flowable<Progress> |
getProgress()
Returns an
Observable that emits Progress events of the download. | ||||||||||
| boolean |
isComplete()
Returns
true if the download has been successfully completed. | ||||||||||
| void |
setProgressListener(DownloadJob.ProgressListener progressListener)
Set a
DownloadJob.ProgressListener for monitoring the download. | ||||||||||
| static DownloadJob |
startDownload(DownloadRequest request)
Create a new
DownloadJob from a DownloadRequest. | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Cancel the running download. Listeners won't receive a completion event after calling this method.
Returns the output file as defined by the started DownloadRequest.
File pointing to the download output.
Returns an Observable that emits Progress events of the download. When using this, make sure to properly handle back pressure.
Observable emitting download Progress events.
Returns true if the download has been successfully completed.
true if the download has been completed, otherwise false.
Set a DownloadJob.ProgressListener for monitoring the download.
Calling this method will replace any previously set listener.
You may provide null to clear the listener.
Note: Progress listener methods will be notified on the main thread.
| progressListener | DownloadJob.ProgressListener that should be notified, or null to clear the listener.
|
|---|
Create a new DownloadJob from a DownloadRequest.
| request | DownloadRequest that should be executed. |
|---|
DownloadJob based on the given request.