public final class DownloaderConstructorHelper
extends java.lang.Object
Downloader
construction.Constructor and Description |
---|
DownloaderConstructorHelper(Cache cache,
DataSource.Factory upstreamDataSourceFactory) |
DownloaderConstructorHelper(Cache cache,
DataSource.Factory upstreamDataSourceFactory,
DataSource.Factory cacheReadDataSourceFactory,
DataSink.Factory cacheWriteDataSinkFactory,
PriorityTaskManager priorityTaskManager) |
Modifier and Type | Method and Description |
---|---|
CacheDataSource |
buildCacheDataSource(boolean offline)
Returns a new
CacheDataSource instance. |
Cache |
getCache()
Returns the
Cache instance. |
PriorityTaskManager |
getPriorityTaskManager()
Returns a
PriorityTaskManager instance. |
public DownloaderConstructorHelper(Cache cache, DataSource.Factory upstreamDataSourceFactory)
cache
- Cache instance to be used to store downloaded data.upstreamDataSourceFactory
- A DataSource.Factory
for downloading data.public DownloaderConstructorHelper(Cache cache, DataSource.Factory upstreamDataSourceFactory, @Nullable DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager)
cache
- Cache instance to be used to store downloaded data.upstreamDataSourceFactory
- A DataSource.Factory
for downloading data.cacheReadDataSourceFactory
- A DataSource.Factory
for reading data from the cache. If null
then standard FileDataSource
instances will be used.cacheWriteDataSinkFactory
- A DataSink.Factory
for writing data to the cache. If
null then standard CacheDataSink
instances will be used.priorityTaskManager
- A PriorityTaskManager
to use when downloading. If non-null,
downloaders will register as tasks with priority C.PRIORITY_DOWNLOAD
whilst
downloading.public PriorityTaskManager getPriorityTaskManager()
PriorityTaskManager
instance.public CacheDataSource buildCacheDataSource(boolean offline)
CacheDataSource
instance. If offline
is true, it can only read
data from the cache.