    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.jigsaw.auth.IPMatcher

    java.lang.Object
       |
       +----org.w3c.jigsaw.auth.IPMatcher

public class IPMatcher
extends 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.

##

IPMatcher()

##

add(short[], Object)
  Associate the given IP adress to the given object.
lookup(byte[])
  Lookup the adress for an association.
lookup(InetAddress)
  Lookup the given InetAdress for any association.
print(PrintStream)
  Print the IP matcher internal tree.

##

IPMatcher

     public IPMatcher()

##

add

     public void add(short a[],
                     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 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 Object lookup(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(PrintStream out)

  Print the IP matcher internal tree.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index