com.limegroup.gnutella
Class UrnCache

java.lang.Object
  extended bycom.limegroup.gnutella.UrnCache

public final class UrnCache
extends java.lang.Object

This class contains a systemwide URN cache that persists file URNs (hashes) across sessions. Modified by Gordon Mohr (2002/02/19): Added URN storage, calculation, caching Repackaged by Greg Bildson (2002/02/19): Moved to dedicated class.

See Also:
FileDesc, URN

Method Summary
 void addUrns(java.io.File file, java.util.Set urns)
          Add URNs for the specified FileDesc instance to URN_MAP.
 java.util.Set getUrns(java.io.File file)
          Find any URNs remembered from a previous session for the specified File instance.
static UrnCache instance()
          Returns the UrnCache instance.
 void persistCache()
          Write cache so that we only have to calculate them once.
 void removeUrns(java.io.File f)
          Removes any URNs that associated with a specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static UrnCache instance()
Returns the UrnCache instance.

Returns:
the UrnCache instance

getUrns

public java.util.Set getUrns(java.io.File file)
Find any URNs remembered from a previous session for the specified File instance. The returned Set is guaranteed to be non-null, but it may be empty.

Parameters:
file - the File instance to look up URNs for
Returns:
a new Set containing any cached URNs for the speficied File instance, guaranteed to be non-null and unmodifiable, but possibly empty

removeUrns

public void removeUrns(java.io.File f)
Removes any URNs that associated with a specified file.


addUrns

public void addUrns(java.io.File file,
                    java.util.Set urns)
Add URNs for the specified FileDesc instance to URN_MAP.


persistCache

public void persistCache()
Write cache so that we only have to calculate them once.