com.caucho.util
Class InetNetwork

java.lang.Object
  extended by com.caucho.util.InetNetwork

public class InetNetwork
extends java.lang.Object

Represents an internet network mask.


Constructor Summary
InetNetwork(java.net.InetAddress inetAddress, int maskIndex)
          Create a internet mask.
InetNetwork(long address, int maskIndex)
          Creates an inet network with a mask.
InetNetwork(long hiAddress, long loAddress, int maskIndex)
          Creates an inet network with a mask.
 
Method Summary
static InetNetwork create(java.lang.String network)
           
static InetNetwork createIPv6(java.lang.String network)
           
 boolean isMatch(byte[] bytes)
          Returns true if the address is in this network.
 boolean isMatch(java.net.InetAddress inetAddress)
          Returns true if the address is in this network.
 boolean isMatch(long address)
          Returns true if the address is in this network.
 boolean isMatch(java.lang.String address)
          Returns true if the address is in this network.
 java.lang.String toString()
          Return a readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InetNetwork

public InetNetwork(java.net.InetAddress inetAddress,
                   int maskIndex)
Create a internet mask.

Parameters:
inetAddress - the main address
maskIndex - the number of bits to match.

InetNetwork

public InetNetwork(long address,
                   int maskIndex)
Creates an inet network with a mask.


InetNetwork

public InetNetwork(long hiAddress,
                   long loAddress,
                   int maskIndex)
Creates an inet network with a mask.

Method Detail

create

public static InetNetwork create(java.lang.String network)

createIPv6

public static InetNetwork createIPv6(java.lang.String network)

isMatch

public boolean isMatch(java.net.InetAddress inetAddress)
Returns true if the address is in this network.


isMatch

public boolean isMatch(byte[] bytes)
Returns true if the address is in this network.


isMatch

public boolean isMatch(java.lang.String address)
Returns true if the address is in this network.


isMatch

public boolean isMatch(long address)
Returns true if the address is in this network.


toString

public java.lang.String toString()
Return a readable string.

Overrides:
toString in class java.lang.Object