Class AbstractDownloader

  • All Implemented Interfaces:
    Downloader
    Direct Known Subclasses:
    HttpClientDownloader

    public abstract class AbstractDownloader
    extends java.lang.Object
    implements Downloader
    Base class of downloader with some common methods.
    Since:
    0.5.0
    Author:
    code4crafter@gmail.com
    • Constructor Detail

      • AbstractDownloader

        public AbstractDownloader()
    • Method Detail

      • download

        public Html download​(java.lang.String url)
        A simple method to download a url.
        Parameters:
        url - url
        Returns:
        html
      • download

        public Html download​(java.lang.String url,
                             java.lang.String charset)
        A simple method to download a url.
        Parameters:
        url - url
        charset - charset
        Returns:
        html
      • onSuccess

        protected void onSuccess​(Page page,
                                 Task task)
        Parameters:
        page - the Page.
        task - the Task.
        Since:
        0.10.0
      • onError

        protected void onError​(Page page,
                               Task task,
                               java.lang.Throwable e)
        Parameters:
        page - the Page.
        task - the Task.
        e - the exception.
        Since:
        0.10.0