org.w3c.jigsaw.auth
Class IPMatcher
java.lang.Object
|
+--org.w3c.jigsaw.auth.IPMatcher
- public class IPMatcher
- extends java.lang.Object
A fast way of associating IP adresses to any Object.
This IPMatcher classes maps IP adresses to objects. It understands wild
cards, encoded as ((short) 256). Wild card will match any adress below it.
Method Summary |
void |
add(short[] a,
java.lang.Object closure)
Associate the given IP adress to the given object. |
java.lang.Object |
lookup(byte[] a)
Lookup the adress for an association. |
java.lang.Object |
lookup(java.net.InetAddress inetadr)
Lookup the given InetAdress for any association. |
void |
print(java.io.PrintStream out)
Print the IP matcher internal tree. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
IPMatcher
public IPMatcher()
add
public void add(short[] a,
java.lang.Object closure)
- Associate the given IP adress to the given object.
This method takes as parameter an array of short in order
to extend natural IP adresses bytes with the wild card character.
- Parameters:
a
- The adress to use as a key for the association.closure
- The associated object.
lookup
public java.lang.Object lookup(byte[] a)
- Lookup the adress for an association.
- Parameters:
a
- The adress to look for.- Returns:
- The object associated to the given IP address, or
null if none was found.
lookup
public java.lang.Object lookup(java.net.InetAddress inetadr)
- Lookup the given InetAdress for any association.
- Parameters:
inetadr
- The inet adress to look for.- Returns:
- The object associated to the given IP adress, or
null if none was found.
print
public void print(java.io.PrintStream out)
- Print the IP matcher internal tree.