|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.downloader.AbstractCoreDownloader
public abstract class AbstractCoreDownloader
A basic implementation of CoreDownloader. Subclasses still need to do the heavy-lifting.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.limegroup.gnutella.DownloaderInfo |
|---|
DownloaderInfo.DownloadState |
| Field Summary |
|---|
| Fields inherited from interface com.limegroup.gnutella.Downloader |
|---|
BITTORRENT_DOWNLOAD, CUSTOM_INACTIVITY_KEY |
| Constructor Summary | |
|---|---|
protected |
AbstractCoreDownloader(SaveLocationManager saveLocationManager)
|
| Method Summary | |
|---|---|
boolean |
conflictsSaveFile(File saveFile)
|
protected abstract DownloadMemento |
createMemento()
Constructs the correct type of memento. |
protected void |
fillInMemento(DownloadMemento memento)
Fills in all data this class wants to store. |
Object |
getAttribute(String key)
Gets a value of attribute associated with the download. |
protected String |
getDefaultFileName()
Returns the value for the key CoreDownloader#DEFAULT_FILENAME from
the properties map. |
protected abstract File |
getDefaultSaveFile()
A default location where this file should be saved, if no explicit saveFile is set. |
int |
getInactivePriority()
Returns the inactive priority of this download. |
File |
getSaveFile()
Returns the file under which the download will be saved when complete. |
protected boolean |
hasDefaultFileName()
Returns true if a defaultFileName is set. |
void |
initFromMemento(DownloadMemento memento)
Initializes this object from the given memento. |
boolean |
isMementoSupported()
Indicator of whether this downloader supports a memento or not. |
Object |
removeAttribute(String key)
Removes an attribute associated with this download. |
Object |
setAttribute(String key,
Object value,
boolean serialize)
Sets a new attribute associated with the download. |
protected void |
setDefaultFileName(String defaultFileName)
Sets the default filename this will use. |
void |
setInactivePriority(int priority)
Sets the inactive priority of this download. |
void |
setSaveFile(File saveDirectory,
String fileName,
boolean overwrite)
Sets the directory where the file will be saved. |
DownloadMemento |
toMemento()
Constructs a memento that will be used for serialization. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.limegroup.gnutella.downloader.CoreDownloader |
|---|
conflicts, conflictsWithIncompleteFile, finish, getDownloadType, getQueryGUID, handleInactivity, initialize, isAlive, isQueuable, shouldBeRemoved, shouldBeRestarted, startDownload |
| Methods inherited from interface com.limegroup.gnutella.DownloaderInfo |
|---|
getAmountRead, getContentLength, getState, isCompleted |
| Methods inherited from interface com.limegroup.gnutella.BandwidthTracker |
|---|
getAverageBandwidth, getMeasuredBandwidth, measureBandwidth |
| Methods inherited from interface org.limewire.listener.ListenerSupport |
|---|
addListener, removeListener |
| Constructor Detail |
|---|
protected AbstractCoreDownloader(SaveLocationManager saveLocationManager)
| Method Detail |
|---|
public void setInactivePriority(int priority)
CoreDownloader
setInactivePriority in interface CoreDownloaderpublic int getInactivePriority()
Downloader
getInactivePriority in interface Downloader
public Object setAttribute(String key,
Object value,
boolean serialize)
Downloader
setAttribute in interface Downloaderkey - A key used to identify the attribute.value - The value of the key.serialize - Whether the attribute should be serialized to disk.
null
if the attribute wasn't set.public Object getAttribute(String key)
Downloader
getAttribute in interface Downloaderkey - A key which identifies the attribute.
null if value was not specified.public Object removeAttribute(String key)
Downloader
removeAttribute in interface Downloaderkey - A key which identifies the attribute do remove.
null if
attribute was not set.public boolean conflictsSaveFile(File saveFile)
conflictsSaveFile in interface CoreDownloader
public void setSaveFile(File saveDirectory,
String fileName,
boolean overwrite)
throws SaveLocationException
DownloadersaveDirectory
is null, the default save directory will be used.
setSaveFile in interface DownloadersaveDirectory - the directory where the file should be saved. null
indicates the default.fileName - the name of the file to be saved in saveDirectory.
null indicates the default.overwrite - is true if saving should be allowed to overwrite existing files
SaveLocationException - when the new file location could not be setpublic File getSaveFile()
Downloader
getSaveFile in interface Downloaderprotected abstract File getDefaultSaveFile()
protected String getDefaultFileName()
CoreDownloader#DEFAULT_FILENAME from
the properties map.
Subclasses should put the name into the map or override this method.
protected boolean hasDefaultFileName()
protected void setDefaultFileName(String defaultFileName)
public void initFromMemento(DownloadMemento memento)
throws InvalidDataException
CoreDownloader
initFromMemento in interface CoreDownloaderInvalidDataException - if the memento contains invalid data.public final DownloadMemento toMemento()
CoreDownloader
toMemento in interface CoreDownloaderprotected abstract DownloadMemento createMemento()
protected void fillInMemento(DownloadMemento memento)
public boolean isMementoSupported()
CoreDownloader
isMementoSupported in interface CoreDownloader
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||