-
public final class DownloadRequestQueueCreate the download dispatchers according to pool size. Any number higher than 10 or less than 1, then the size will be default size.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDownloadRequestQueue.Companion
-
Field Summary
Fields Modifier and Type Field Description private final IntegerdownloadingSize
-
Constructor Summary
Constructors Constructor Description DownloadRequestQueue(Integer threadPoolSize, Logger logger)
-
Method Summary
Modifier and Type Method Description final IntegergetDownloadingSize()final Unitstart()Starts the dispatchers in this queue. final Booleanadd(DownloadRequest request)Add download request to the download request queue. final Booleancancel(Integer downloadId)Cancel a download in progress. final UnitcancelAll()Cancel all the download. final DownloadStatequery(Integer downloadId)To check if the request is downloading according to download id. final DownloadStatequery(Uri uri)To check if the request is downloading according to download url. final Unitfinish(DownloadRequest request)The download has finished and remove from set. final Unitrelease()Release all the resource. -
-
Method Detail
-
getDownloadingSize
final Integer getDownloadingSize()
-
add
final Boolean add(DownloadRequest request)
Add download request to the download request queue.
- Parameters:
request- download request
-
cancel
final Boolean cancel(Integer downloadId)
Cancel a download in progress.
- Parameters:
downloadId- download id
-
query
final DownloadState query(Integer downloadId)
To check if the request is downloading according to download id.
- Parameters:
downloadId- download id
-
query
final DownloadState query(Uri uri)
To check if the request is downloading according to download url.
- Parameters:
uri- the uri to check
-
finish
final Unit finish(DownloadRequest request)
The download has finished and remove from set.
- Parameters:
request- download request
-
-
-
-