org.lastbamboo.common.download
Class AbstractDownloader<T extends DownloaderState>

java.lang.Object
  extended by org.lastbamboo.common.download.AbstractDownloader<T>
Type Parameters:
T - The downloader state type.
All Implemented Interfaces:
Downloader<T>
Direct Known Subclasses:
DummySha1Downloader, MultiSourceDownloader, Sha1Downloader

public abstract class AbstractDownloader<T extends DownloaderState>
extends Object
implements Downloader<T>

An abstract base class to help implement downloaders.


Constructor Summary
AbstractDownloader()
          Initializes this abstract base class.
 
Method Summary
 void addListener(DownloaderListener<T> listener)
          Adds a listener to be notified of events of this downloader.
protected  void fireStateChanged(T state)
          Fires notification that this downloader's state has changed.
 long getStartTime()
          Accessor the time the download started.
 void removeListener(DownloaderListener<T> listener)
          Removes a listener that was being notified of events of this downloader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.lastbamboo.common.download.Downloader
getCompleteFile, getFinalName, getIncompleteFile, getSize, getState, isStarted, pause, resume, start, stop, write
 

Constructor Detail

AbstractDownloader

public AbstractDownloader()
Initializes this abstract base class.

Method Detail

fireStateChanged

protected final void fireStateChanged(T state)
Fires notification that this downloader's state has changed.

Parameters:
state - The new state.

addListener

public final void addListener(DownloaderListener<T> listener)
Description copied from interface: Downloader
Adds a listener to be notified of events of this downloader.

Specified by:
addListener in interface Downloader<T extends DownloaderState>
Parameters:
listener - The listener to be notified.

removeListener

public void removeListener(DownloaderListener<T> listener)
Description copied from interface: Downloader
Removes a listener that was being notified of events of this downloader.

Specified by:
removeListener in interface Downloader<T extends DownloaderState>
Parameters:
listener - The listener to remove.

getStartTime

public long getStartTime()
Description copied from interface: Downloader
Accessor the time the download started.

Specified by:
getStartTime in interface Downloader<T extends DownloaderState>
Returns:
The time the download started.


Copyright © 2013 LittleShoot. All Rights Reserved.