-
public interface DownloaderA mechanism to download files from network. It's easy to use custom downloader by implementing this interface, and then set it in DownloadManager.
-
-
Method Summary
Modifier and Type Method Description abstract StringdetectFilename(Uri uri)Detect filename from http header/url if existed. abstract Integerstart(Uri uri, Long breakpoint)Init downloader and start to download. abstract LongcontentLength()Get content length for current uri. abstract InputStreambyteStream()Get input stream supported by downloader. abstract Unitclose()Close downloader and stop downloader. abstract Downloadercopy()Make a copy for this downloader. -
-
Method Detail
-
detectFilename
abstract String detectFilename(Uri uri)
Detect filename from http header/url if existed.
- Parameters:
uri- uri to detect filename
-
start
abstract Integer start(Uri uri, Long breakpoint)
Init downloader and start to download. The downloader should handle redirect status code, such as 301, 302 and so on.
- Parameters:
uri- Uribreakpoint- breakpoint if exists
-
contentLength
abstract Long contentLength()
Get content length for current uri.
-
byteStream
abstract InputStream byteStream()
Get input stream supported by downloader.
-
copy
abstract Downloader copy()
Make a copy for this downloader.
-
-
-
-