Package 

Interface Downloader


  • 
    public interface Downloader
    
                        

    A 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 String detectFilename(Uri uri) Detect filename from http header/url if existed.
      abstract Integer start(Uri uri, Long breakpoint) Init downloader and start to download.
      abstract Long contentLength() Get content length for current uri.
      abstract InputStream byteStream() Get input stream supported by downloader.
      abstract Unit close() Close downloader and stop downloader.
      abstract Downloader copy() Make a copy for this downloader.
      • Methods inherited from class java.lang.Object

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

         abstract Unit close()

        Close downloader and stop downloader.