Package 

Class OkHttpDownloader

  • All Implemented Interfaces:
    com.coolerfall.download.Downloader

    
    public final class OkHttpDownloader
     implements Downloader
                        

    A downloader implemented by OkHttpClient.

    • Method Summary

      Modifier and Type Method Description
      String detectFilename(Uri uri) Detect filename from http header/url if existed.
      Integer start(Uri uri, Long breakpoint) Init downloader and start to download.
      Long contentLength() Get content length for current uri.
      InputStream byteStream() Get input stream supported by downloader.
      Unit close() Close downloader and stop downloader.
      Downloader copy() Make a copy for this downloader.
      final Response innerRequest(OkHttpClient client, Uri uri, Long breakpoint)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 - Uri
        breakpoint - breakpoint if exists
      • close

         Unit close()

        Close downloader and stop downloader.