edu.internet2.middleware.shibboleth.idp.util
Class IPRange

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.idp.util.IPRange

public class IPRange
extends Object

Represents a range of IP addresses.


Constructor Summary
IPRange(byte[] networkAddress, int maskSize)
          Constructor
IPRange(InetAddress networkAddress, int maskSize)
          Constructor
 
Method Summary
 boolean contains(byte[] address)
          Determines whether the given address is contained in the IP range.
 boolean contains(InetAddress address)
          Determines whether the given address is contained in the IP range.
static IPRange parseCIDRBlock(String cidrBlock)
          Parses a CIDR block definition in to an IP range.
protected  BitSet toBitSet(byte[] bytes)
          Converts a byte array to a BitSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPRange

public IPRange(InetAddress networkAddress,
               int maskSize)
Constructor

Parameters:
networkAddress - the network address for the range
maskSize - the number of bits in the netmask

IPRange

public IPRange(byte[] networkAddress,
               int maskSize)
Constructor

Parameters:
networkAddress - the network address for the range
maskSize - the number of bits in the netmask
Method Detail

parseCIDRBlock

public static IPRange parseCIDRBlock(String cidrBlock)
Parses a CIDR block definition in to an IP range.

Parameters:
cidrBlock - the CIDR block definition
Returns:
the resultant IP range

contains

public boolean contains(InetAddress address)
Determines whether the given address is contained in the IP range.

Parameters:
address - the address to check
Returns:
true if the address is in the range, false it not

contains

public boolean contains(byte[] address)
Determines whether the given address is contained in the IP range.

Parameters:
address - the address to check
Returns:
true if the address is in the range, false it not

toBitSet

protected BitSet toBitSet(byte[] bytes)
Converts a byte array to a BitSet. The supplied byte array is assumed to have the most significant bit in element 0.

Parameters:
bytes - the byte array with most significant bit in element 0.
Returns:
the BitSet


Copyright © 2006-2009 Internet2. All Rights Reserved.