public final class OkHttp3Downloader extends java.lang.Object implements Downloader
Downloader which uses OkHttp to download images.| Constructor and Description |
|---|
OkHttp3Downloader(Call.Factory client)
Create a new downloader that uses the specified
Call.Factory instance. |
OkHttp3Downloader(android.content.Context context)
Create new downloader that uses OkHttp.
|
OkHttp3Downloader(android.content.Context context,
long maxSize)
Create new downloader that uses OkHttp.
|
OkHttp3Downloader(java.io.File cacheDir)
Create new downloader that uses OkHttp.
|
OkHttp3Downloader(java.io.File cacheDir,
long maxSize)
Create new downloader that uses OkHttp.
|
OkHttp3Downloader(OkHttpClient client)
Create a new downloader that uses the specified OkHttp instance.
|
| Modifier and Type | Method and Description |
|---|---|
Response |
load(Request request)
Download the specified image
url from the internet. |
void |
shutdown()
Allows to perform a clean up for this
Downloader including closing the disk cache and
other resources. |
public OkHttp3Downloader(android.content.Context context)
public OkHttp3Downloader(java.io.File cacheDir)
cacheDir - The directory in which the cache should be storedpublic OkHttp3Downloader(android.content.Context context,
long maxSize)
maxSize - The size limit for the cache.public OkHttp3Downloader(java.io.File cacheDir,
long maxSize)
cacheDir - The directory in which the cache should be storedmaxSize - The size limit for the cache.public OkHttp3Downloader(OkHttpClient client)
public OkHttp3Downloader(Call.Factory client)
Call.Factory instance.public Response load(Request request) throws java.io.IOException
Downloaderurl from the internet.load in interface Downloaderjava.io.IOException - if the requested URL cannot successfully be loaded.public void shutdown()
DownloaderDownloader including closing the disk cache and
other resources.shutdown in interface Downloader