|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Downloader
Defines an interface for downloading a file. The user interface maintains a
list of Downloader's and uses its methods to stop and
resume downloads. Note that there is no start method;
it is assumed that the downloader will start as soon as it is instantiated.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.limegroup.gnutella.DownloaderInfo |
|---|
DownloaderInfo.DownloadState |
| Field Summary | |
|---|---|
static String |
BITTORRENT_DOWNLOAD
Marker string for BitTorrent downloads. |
static String |
CUSTOM_INACTIVITY_KEY
Key for custom description of the inactivity state. |
| Method Summary | |
|---|---|
void |
deleteIncompleteFiles()
Deletes the incomplete files for this downloader. |
void |
discardCorruptDownload(boolean delete)
Either treats a corrupt file as normal file and saves it, or discards the corruptFile, depending on the value of delete. |
long |
getAmountLost()
|
int |
getAmountPending()
|
long |
getAmountVerified()
|
Object |
getAttribute(String key)
Gets a value of attribute associated with the download. |
RemoteFileDesc |
getBrowseEnabledHost()
Returns a browse-enabled RemoteFileDesc instance for this Downloader. |
int |
getBusyHostCount()
|
int |
getChunkSize()
|
String |
getCustomIconDescriptor()
|
File |
getDownloadFragment()
If this download is not yet complete, returns a copy of the first contiguous fragment of the incomplete file. |
File |
getFile()
Returns the file that this downloader is using. |
int |
getInactivePriority()
Returns the inactive priority of this download. |
int |
getNumberOfAlternateLocations()
Return the number of validated alternate locations for this download. |
int |
getNumberOfInvalidAlternateLocations()
Return the number of invalid alternate locations for this download. |
int |
getNumHosts()
|
int |
getPossibleHostCount()
|
int |
getQueuedHostCount()
|
int |
getQueuePosition()
Returns the position of the download on the uploader, relevant only if the downloader is queued. |
int |
getRemainingStateTime()
Returns an upper bound on the amount of time (in seconds) this will stay in the current state. |
File |
getSaveFile()
Returns the file under which the download will be saved when complete. |
URN |
getSha1Urn()
Returns the sha1 urn associated with the file being downloaded, or null if there is none. |
List<Address> |
getSourcesAsAddresses()
Gets all sources as addresses |
int |
getTriedHostCount()
Returns the number of hosts that were attempted to connect to. |
String |
getVendor()
Returns the vendor of the last downloading host. |
boolean |
hasBrowseEnabledHost()
Returns whether or not there is a browse-enabled host available for this Downloader. |
boolean |
isInactive()
Determines if this downloader is in an inactive state |
boolean |
isLaunchable()
|
boolean |
isPausable()
|
boolean |
isPaused()
Determines if this download is paused or not. |
boolean |
isRelocatable()
Determines if this can have its saveLocation changed. |
boolean |
isResumable()
|
void |
pause()
Pauses this download. |
Object |
removeAttribute(String key)
Removes an attribute associated with this download. |
boolean |
resume()
Resumes this. |
Object |
setAttribute(String key,
Object value,
boolean serialize)
Sets a new attribute associated with the download. |
void |
setSaveFile(File saveDirectory,
String fileName,
boolean overwrite)
Sets the directory where the file will be saved. |
void |
stop()
Stops this download if it is not already stopped. |
| 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 |
| Field Detail |
|---|
static final String BITTORRENT_DOWNLOAD
static final String CUSTOM_INACTIVITY_KEY
| Method Detail |
|---|
void stop()
void pause()
boolean isPaused()
boolean isPausable()
boolean isResumable()
boolean isInactive()
boolean isRelocatable()
int getInactivePriority()
boolean resume()
File getFile()
getDownloadFragment() for the reasons described in that
method.
File getDownloadFragment()
void setSaveFile(File saveDirectory,
String fileName,
boolean overwrite)
throws SaveLocationException
saveDirectory
is null, the default save directory will be used.
saveDirectory - 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 setFile getSaveFile()
int getRemainingStateTime()
Integer.MAX_VALUE if unknown.
int getAmountPending()
int getNumHosts()
DownloadState#DOWNLOADING state.String getVendor()
boolean isLaunchable()
void discardCorruptDownload(boolean delete)
RemoteFileDesc getBrowseEnabledHost()
boolean hasBrowseEnabledHost()
int getQueuePosition()
int getNumberOfAlternateLocations()
int getNumberOfInvalidAlternateLocations()
int getPossibleHostCount()
int getBusyHostCount()
int getQueuedHostCount()
int getTriedHostCount()
DownloadState#CONNECTING state.
long getAmountVerified()
int getChunkSize()
long getAmountLost()
URN getSha1Urn()
null if there is none.
Object setAttribute(String key,
Object value,
boolean serialize)
key - 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.Object getAttribute(String key)
key - A key which identifies the attribute.
null if value was not specified.Object removeAttribute(String key)
key - A key which identifies the attribute do remove.
null if
attribute was not set.String getCustomIconDescriptor()
List<Address> getSourcesAsAddresses()
void deleteIncompleteFiles()
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||