public class UrlConnectionDownloader extends java.lang.Object implements Downloader
Downloader which uses HttpURLConnection to download images. A disk cache of 2%
of the total available space will be used (capped at 50MB) will automatically be installed in the
application's cache directory, when available.Downloader.Response, Downloader.ResponseException| Constructor and Description |
|---|
UrlConnectionDownloader(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
Downloader.Response |
load(android.net.Uri uri,
int networkPolicy)
Download the specified image
url from the internet. |
protected java.net.HttpURLConnection |
openConnection(android.net.Uri path) |
void |
shutdown()
Allows to perform a clean up for this
Downloader including closing the disk cache and
other resources. |
public UrlConnectionDownloader(android.content.Context context)
protected java.net.HttpURLConnection openConnection(android.net.Uri path)
throws java.io.IOException
java.io.IOExceptionpublic Downloader.Response load(android.net.Uri uri, int networkPolicy) throws java.io.IOException
Downloaderurl from the internet.load in interface Downloaderuri - Remote image URL.networkPolicy - The NetworkPolicy used for this request.Downloader.Response containing either a Bitmap representation of the request or an
InputStream for the image data. null can be returned to indicate a problem
loading the bitmap.java.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