-
- All Implemented Interfaces:
-
com.coolerfall.download.Downloader
public final class OkHttpDownloader implements Downloader
A downloader implemented by OkHttpClient.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classOkHttpDownloader.Companion
-
Method Summary
Modifier and Type Method Description StringdetectFilename(Uri uri)Detect filename from http header/url if existed. Integerstart(Uri uri, Long breakpoint)Init downloader and start to download. LongcontentLength()Get content length for current uri. InputStreambyteStream()Get input stream supported by downloader. Unitclose()Close downloader and stop downloader. Downloadercopy()Make a copy for this downloader. final ResponseinnerRequest(OkHttpClient client, Uri uri, Long breakpoint)-
-
Method Detail
-
detectFilename
String detectFilename(Uri uri)
Detect filename from http header/url if existed.
- Parameters:
uri- uri to detect filename
-
start
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
Long contentLength()
Get content length for current uri.
-
byteStream
InputStream byteStream()
Get input stream supported by downloader.
-
copy
Downloader copy()
Make a copy for this downloader.
-
innerRequest
final Response innerRequest(OkHttpClient client, Uri uri, Long breakpoint)
-
-
-
-