Class TorrentDownloaderImpl

    • Field Detail

      • uid

        private static final java.util.concurrent.atomic.AtomicLong uid
      • original_url

        private java.lang.String original_url
      • url_str

        private java.lang.String url_str
      • proxy

        private java.net.Proxy proxy
      • referrer

        private java.lang.String referrer
      • request_properties

        private java.util.Map request_properties
      • file_str

        private java.lang.String file_str
      • url

        private java.net.URL url
      • con

        private java.net.URLConnection con
      • error

        private java.lang.String error
      • status

        private java.lang.String status
      • state

        private int state
      • percentDone

        private int percentDone
      • readTotal

        private int readTotal
      • cancel

        private boolean cancel
      • filename

        private java.lang.String filename
      • directoryname

        private java.lang.String directoryname
      • file

        private java.io.File file
      • buf

        private final byte[] buf
      • bufBytes

        private int bufBytes
      • deleteFileOnCancel

        private boolean deleteFileOnCancel
      • ignoreReponseCode

        private boolean ignoreReponseCode
      • errCode

        private int errCode
    • Constructor Detail

      • TorrentDownloaderImpl

        public TorrentDownloaderImpl()
    • Method Detail

      • init

        public void init​(TorrentDownloaderCallBackInterface _iface,
                         java.lang.String _url,
                         java.net.Proxy _proxy,
                         java.lang.String _referrer,
                         java.util.Map _request_properties,
                         java.lang.String _file)
      • notifyListener

        public void notifyListener()
      • cleanUpFile

        private void cleanUpFile()
      • error

        private void error​(int errCode,
                           java.lang.String err)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getError

        public java.lang.String getError()
        Description copied from interface: TorrentDownloader
        Returns the error string if one occured, "Ok" otherwise.
        Specified by:
        getError in interface TorrentDownloader
      • setError

        public void setError​(int errCode,
                             java.lang.String err)
      • getErrorCode

        public int getErrorCode()
      • setStatus

        protected void setStatus​(java.lang.String str)
      • getPercentDone

        public int getPercentDone()
        Description copied from interface: TorrentDownloader
        Returns the amount downloaded in per cent. Gives -1 if total size is not available.
        Specified by:
        getPercentDone in interface TorrentDownloader
      • setDownloadState

        public void setDownloadState​(int state)
      • closeConnection

        protected void closeConnection()
      • setDownloadPath

        public void setDownloadPath​(java.lang.String path,
                                    java.lang.String file)
        Description copied from interface: TorrentDownloader
        Changes the path and filename to download to. You can give null for either to leave it as is. (These are initialized to either the path/filename given via TorrentDownloaderFactory.download(Managed) or to the default torrent save directory (path) and the filename the server proposes (file). This function does nothing after the download has been started.
        Specified by:
        setDownloadPath in interface TorrentDownloader
        Parameters:
        path - The path for download.
        file - The file name for download.