org.dspace.authenticate
Class IPMatcher

java.lang.Object
  extended by org.dspace.authenticate.IPMatcher

public class IPMatcher
extends Object

Quickly tests whether a given IPv4 4-byte address matches an IP range. An IPMatcher is initialized with a particular IP range specification. Calls to match method will then quickly determine whether a given IP falls within that range.

Supported range specifications areL

Version:
$Revision: 3735 $
Author:
Robert Tansley

Constructor Summary
IPMatcher(String ipSpec)
          Construct an IPMatcher that will test for the given IP specification
 
Method Summary
 boolean match(String ipIn)
          Determine whether the given full IP falls within the range this IPMatcher was initialized with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPMatcher

public IPMatcher(String ipSpec)
          throws IPMatcherException
Construct an IPMatcher that will test for the given IP specification

Parameters:
ipSpec - IP specification (full or partial URL, network/netmask, network/cidr)
Throws:
IPMatcherException - if there is an error parsing the specification (i.e. it is somehow malformed)
Method Detail

match

public boolean match(String ipIn)
              throws IPMatcherException
Determine whether the given full IP falls within the range this IPMatcher was initialized with.

Parameters:
ipIn - IP address as dot-delimited String
Returns:
true if the IP matches the range of this IPMatcher; false otherwise
Throws:
IPMatcherException - if the IP passed in cannot be parsed correctly (i.e. is malformed)


Copyright © 2010 DuraSpace. All Rights Reserved.