org.apache.james.util.netmatcher
Class NetMatcher

java.lang.Object
  extended by org.apache.james.util.netmatcher.NetMatcher

public class NetMatcher
extends java.lang.Object

NetMatcher Class is used to check if an ipAddress match a network. NetMatcher provides a means for checking whether a particular IPv4 or IPv6 address or domain name is within a set of subnets.


Constructor Summary
NetMatcher(java.util.Collection<java.lang.String> nets, DNSService dnsServer)
          Create a new instance of Netmatcher.
NetMatcher(java.lang.String[] nets, DNSService dnsServer)
          Create a new instance of Netmatcher.
 
Method Summary
protected  void log(java.lang.String s)
          Can be overwritten for logging
 boolean matchInetNetwork(java.net.InetAddress ip)
          Return true if passed InetAddress match a network which was used to construct the Netmatcher.
 boolean matchInetNetwork(java.lang.String hostIP)
          The given String may represent an IP address or a host name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetMatcher

public NetMatcher(java.lang.String[] nets,
                  DNSService dnsServer)
Create a new instance of Netmatcher.

Parameters:
nets - a String[] which holds all networks
dnsServer - the DNSService which will be used in this class

NetMatcher

public NetMatcher(java.util.Collection<java.lang.String> nets,
                  DNSService dnsServer)
Create a new instance of Netmatcher.

Parameters:
nets - a Collection which holds all networks
dnsServer - the DNSService which will be used in this class
Method Detail

matchInetNetwork

public boolean matchInetNetwork(java.lang.String hostIP)
The given String may represent an IP address or a host name.

Parameters:
hostIP - the ipAddress or host name to check
See Also:
matchInetNetwork(InetAddress)

matchInetNetwork

public boolean matchInetNetwork(java.net.InetAddress ip)
Return true if passed InetAddress match a network which was used to construct the Netmatcher.

Parameters:
an - InetAddress
Returns:
true if match the network

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
InetNetwork#toString()

log

protected void log(java.lang.String s)
Can be overwritten for logging

Parameters:
s - the String to log


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.