|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.downloader.IncompleteFileManager
A repository of temporary filenames. Gives out file names for temporary files, ensuring that two duplicate files always get the same name. This enables smart resumes across hosts. Also keeps track of the blocks downloaded, for smart downloading purposes. Thread safe.
Field Summary | |
static java.lang.String |
PREVIEW_PREFIX
The prefix added to preview copies of incomplete files. |
Constructor Summary | |
IncompleteFileManager()
|
Method Summary | |
void |
addEntry(java.io.File incompleteFile,
VerifyingFile vf)
Associates the incompleteFile with the VerifyingFile vf. |
java.util.Set |
getAllCompletedHashes(java.io.File incompleteFile)
Returns any known hashes of the complete file associated with the given incomplete file, i.e., the hashes of incompleteFile when the download is complete. |
int |
getBlockSize(java.io.File incompleteFile)
|
URN |
getCompletedHash(java.io.File incompleteFile)
Returns the hash of the complete file associated with the given incomplete file, i.e., the hash of incompleteFile when the download is complete. |
static java.lang.String |
getCompletedName(java.io.File incompleteFile)
Returns the name of the complete file associated with the given incomplete file, i.e., what incompleteFile will be renamed to when the download completes (without path information). |
static long |
getCompletedSize(java.io.File incompleteFile)
Returns the size of the complete file associated with the given incomplete file, i.e., the number of bytes in the file when the download completes. |
VerifyingFile |
getEntry(java.io.File incompleteFile)
|
java.io.File |
getFile(RemoteFileDesc rfd)
Returns the fully-qualified temporary download file for the given file/location pair. |
java.io.File |
getFileForUrn(URN urn)
Returns the file associated with the specified URN. |
boolean |
purge(boolean initialPurge)
Deletes incomplete files more than INCOMPLETE_PURGE_TIME days old from disk. |
void |
registerAllIncompleteFiles()
Notifies file manager about all incomplete files. |
void |
removeEntry(java.io.File incompleteFile)
Removes the block and hash information for the given incomplete file. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PREVIEW_PREFIX
Constructor Detail |
public IncompleteFileManager()
Method Detail |
public boolean purge(boolean initialPurge)
initialPurge
- true iff this was just read from disk, i.e., if this
is being called from readSnapshot() instead of getFiles(). Hashes will
only be purged if initialPurge==true.
public java.io.File getFile(RemoteFileDesc rfd)
This method gives duplicate files the same temporary file, which is critical for resume and swarmed downloads. That is, for all rfd_i and rfd_j
similar(rfd_i, rfd_j) <==> getFile(rfd_i).equals(getFile(rfd_j))
public java.io.File getFileForUrn(URN urn)
public void removeEntry(java.io.File incompleteFile)
incompleteFile
- a temporary file returned by getFilepublic void addEntry(java.io.File incompleteFile, VerifyingFile vf)
public VerifyingFile getEntry(java.io.File incompleteFile)
public int getBlockSize(java.io.File incompleteFile)
public void registerAllIncompleteFiles()
public static java.lang.String getCompletedName(java.io.File incompleteFile) throws java.lang.IllegalArgumentException
incompleteFile
- a file returned by getFile
java.lang.IllegalArgumentException
- incompleteFile was not the
return value from getFilepublic static long getCompletedSize(java.io.File incompleteFile) throws java.lang.IllegalArgumentException
incompleteFile
- a file returned by getFile
java.lang.IllegalArgumentException
- incompleteFile was not
returned by getFilepublic URN getCompletedHash(java.io.File incompleteFile)
incompleteFile
- a file returned by getFile
public java.util.Set getAllCompletedHashes(java.io.File incompleteFile)
incompleteFile
- a file returned by getFile
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |