|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.downloader.ManagedDownloader
com.limegroup.gnutella.downloader.ResumeDownloader
A ManagedDownloader that tries to resume to a specific incomplete file. The ResumeDownloader initially has no locations to download from. Instead it immediately requeries--by hash if possible--and only accepts results that would result in resumes from the specified incomplete file. Do not be confused by the name; ManagedDownloader CAN resume from incomplete files, but it is less strict about its choice of download.
Field Summary |
Fields inherited from class com.limegroup.gnutella.downloader.ManagedDownloader |
UNKNOWN_FILENAME |
Fields inherited from interface com.limegroup.gnutella.Downloader |
ABORTED, COMPLETE, CONNECTING, CORRUPT_FILE, COULDNT_MOVE_TO_LIBRARY, DOWNLOADING, GAVE_UP, HASHING, QUEUED, REMOTE_QUEUED, SAVING, WAITING_FOR_CONNECTIONS, WAITING_FOR_RESULTS, WAITING_FOR_RETRY, WAITING_FOR_USER |
Constructor Summary | |
ResumeDownloader(IncompleteFileManager incompleteFileManager,
java.io.File incompleteFile,
java.lang.String name,
int size)
Creates a RequeryDownloader to finish downloading incompleteFile. |
Method Summary | |
protected boolean |
allowAddition(RemoteFileDesc other)
Overrides ManagedDownloader to allow any RemoteFileDesc that would resume from _incompleteFile. |
boolean |
conflicts(java.io.File incompleteFile)
Overrides ManagedDownloader to reserve _incompleteFile for this download. |
int |
getContentLength()
Overrides ManagedDownloader to display a reasonable file size even when no locations have been found. |
java.lang.String |
getFileName()
Overrides ManagedDownloader to display a reasonable file name even when no locations have been found. |
void |
initialize(DownloadManager manager,
FileManager fileManager,
ActivityCallback callback,
boolean deserialized)
Overrides ManagedDownloader to ensure that progress is initially non-zero and file previewing works. |
protected QueryRequest |
newRequery(int numRequeries)
Overrides ManagedDownloader to use the filename and hash (if present) of the incomplete file. |
protected boolean |
pauseForRequery(int numRequeries,
boolean deserializedFromDisk)
This dictates whether this downloader should wait for user input before spawning a Requery. |
protected boolean |
shouldInitAltLocs(boolean deserializedFromDisk)
Subclasses should override this method when necessary. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ResumeDownloader(IncompleteFileManager incompleteFileManager, java.io.File incompleteFile, java.lang.String name, int size)
incompleteFile
- the incomplete file to resume to, which
MUST be the result of IncompleteFileManager.getFile.name
- the name of the completed file, which MUST be the result of
IncompleteFileManager.getCompletedName(incompleteFile)size
- the size of the completed file, which MUST be the result of
IncompleteFileManager.getCompletedSize(incompleteFile)Method Detail |
public void initialize(DownloadManager manager, FileManager fileManager, ActivityCallback callback, boolean deserialized)
initialize
in class ManagedDownloader
deserialized
- True if this downloader is being initialized after
being read from disk, false otherwise.public boolean conflicts(java.io.File incompleteFile)
conflicts
in class ManagedDownloader
protected boolean allowAddition(RemoteFileDesc other)
allowAddition
in class ManagedDownloader
public int getContentLength()
getContentLength
in interface Downloader
getContentLength
in class ManagedDownloader
public java.lang.String getFileName()
getFileName
in interface Downloader
getFileName
in class ManagedDownloader
protected boolean pauseForRequery(int numRequeries, boolean deserializedFromDisk) throws java.lang.InterruptedException
ManagedDownloader
pauseForRequery
in class ManagedDownloader
numRequeries
- The number of requeries sent so far.deserializedFromDisk
- If the downloader was deserialized from a
snapshot. May be useful for subclasses.
java.lang.InterruptedException
protected boolean shouldInitAltLocs(boolean deserializedFromDisk)
ManagedDownloader
shouldInitAltLocs
in class ManagedDownloader
protected QueryRequest newRequery(int numRequeries)
newRequery
in class ManagedDownloader
numRequeries
- the number of requeries that have already happened
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |