public class IpSubnet extends java.lang.Object implements IpSet, java.lang.Comparable<IpSubnet>
| Modifier and Type | Field and Description |
|---|---|
private CIDR |
cidr
Internal representation
|
private static InternalLogger |
logger |
| Constructor and Description |
|---|
IpSubnet()
Create IpSubnet for ALL (used for ALLOW or DENY ALL)
|
IpSubnet(java.net.InetAddress inetAddress,
int cidrNetMask)
Create IpSubnet using the CIDR Notation
|
IpSubnet(java.net.InetAddress inetAddress,
java.lang.String netMask)
Create IpSubnet using the normal Notation
|
IpSubnet(java.lang.String netAddress)
Create IpSubnet using the CIDR or normal Notation
i.e.: IpSubnet subnet = new IpSubnet("10.10.10.0/24"); or IpSubnet subnet = new IpSubnet("10.10.10.0/255.255.255.0"); or IpSubnet subnet = new IpSubnet("1fff:0:0a88:85a3:0:0:0:0/24"); |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(IpSubnet o)
Compare two IpSubnet
|
boolean |
contains(java.net.InetAddress inetAddress)
Compares the given InetAddress against the Subnet and returns true if
the ip is in the subnet-ip-range and false if not.
|
boolean |
contains(java.lang.String ipAddr)
Compares the given IP-Address against the Subnet and returns true if
the ip is in the subnet-ip-range and false if not.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
java.lang.String |
toString() |
private static final InternalLogger logger
private final CIDR cidr
public IpSubnet()
public IpSubnet(java.lang.String netAddress)
throws java.net.UnknownHostException
netAddress - a network address as string.java.net.UnknownHostExceptionpublic IpSubnet(java.net.InetAddress inetAddress,
int cidrNetMask)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic IpSubnet(java.net.InetAddress inetAddress,
java.lang.String netMask)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic boolean contains(java.lang.String ipAddr)
throws java.net.UnknownHostException
ipAddr - an ipaddressjava.net.UnknownHostExceptionpublic boolean contains(java.net.InetAddress inetAddress)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object