org.dspace.statistics.util
Class IPTable

java.lang.Object
  extended by org.dspace.statistics.util.IPTable

public class IPTable
extends Object

A Spare v4 IPTable implementation that uses nested HashMaps to optimize IP Address matching over ranges of IP Addresses.

Author:
mdiggory at atmire.com

Nested Class Summary
static class IPTable.IPFormatException
          Exception Class to deal with IPFormat errors.
 
Constructor Summary
IPTable()
           
 
Method Summary
 void add(String ip)
          Can be full v4 IP, subnet or range string
 boolean contains(String ip)
          Check whether a given address is contained in this netblock.
 Set<String> toSet()
          Convert to a Set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPTable

public IPTable()
Method Detail

add

public void add(String ip)
         throws IPTable.IPFormatException
Can be full v4 IP, subnet or range string

Parameters:
ip -
Throws:
IPTable.IPFormatException

contains

public boolean contains(String ip)
                 throws IPTable.IPFormatException
Check whether a given address is contained in this netblock.

Parameters:
ip - the address to be tested
Returns:
true if ip is within this table's limits
Throws:
IPTable.IPFormatException

toSet

public Set<String> toSet()
Convert to a Set.

Returns:
this table's content as a Set


Copyright © 2011 DuraSpace. All Rights Reserved.