|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.protocol.zeroconf.jmdns.DNSCache
class DNSCache
A table of DNS entries. This is a hash table which can handle multiple entries with the same name.
Storing multiple entries with the same name is implemented using a linked list ofCacheNode's.
The current implementation of the API of DNSCache does expose the
cache nodes to clients. Clients must explicitly deal with the nodes
when iterating over entries in the cache. Here's how to iterate over
all entries in the cache:
for (Iterator i=dnscache.iterator(); i.hasNext(); )
{
for ( DNSCache.CacheNode n = (DNSCache.CacheNode) i.next();
n != null;
n.next())
{
DNSEntry entry = n.getValue();
...do something with entry...
}
}
And here's how to iterate over all entries having a given name:
for ( DNSCache.CacheNode n = (DNSCache.CacheNode) dnscache.find(name);
n != null;
n.next())
{
DNSEntry entry = n.getValue();
...do something with entry...
}
| Nested Class Summary | |
|---|---|
static class |
DNSCache.CacheNode
Cache nodes are used to implement storage of multiple DNSEntry's of the same name in the cache. |
| Constructor Summary | |
|---|---|
DNSCache(int size)
Create a table with a given initial size. |
|
| Method Summary | |
|---|---|
void |
add(DNSEntry entry)
Adds an entry to the table. |
void |
clear()
Clears the cache. |
DNSCache.CacheNode |
find(String name)
Iterate only over items with matching name. |
DNSEntry |
get(DNSEntry entry)
Get a matching DNS entry from the table (using equals). |
DNSEntry |
get(String name,
int type,
int clazz)
Get a matching DNS entry from the table. |
Iterator<DNSCache.CacheNode> |
iterator()
Iterates over all cache nodes. |
void |
print()
List all entries for debugging. |
boolean |
remove(DNSEntry entry)
Remove a specific entry from the table. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DNSCache(int size)
size - initial size.| Method Detail |
|---|
public void clear()
public void add(DNSEntry entry)
entry - added to the table.public boolean remove(DNSEntry entry)
entry - removed from table.
public DNSEntry get(DNSEntry entry)
entry - to be found in table.
public DNSEntry get(String name,
int type,
int clazz)
name - type - clazz -
public Iterator<DNSCache.CacheNode> iterator()
public DNSCache.CacheNode find(String name)
name - to be found.
public void print()
public String toString()
toString in class Object
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||