public abstract class CIDR extends Object implements Comparable<CIDR>
Modifier and Type | Field and Description |
---|---|
protected InetAddress |
baseAddress
The base address of the CIDR notation
|
protected int |
cidrMask
The mask used in the CIDR notation
|
Constructor and Description |
---|
CIDR() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
contains(InetAddress inetAddress)
Compares the given InetAddress against the CIDR and returns true if
the ip is in the subnet-ip-range and false if not.
|
boolean |
equals(Object o) |
InetAddress |
getBaseAddress() |
abstract InetAddress |
getEndAddress() |
static byte[] |
getIpV4FromIpV6(Inet6Address address)
Compute a byte representation of IpV4 from a IpV6
|
static byte[] |
getIpV6FromIpV4(Inet4Address address)
Compute a byte representation of IpV6 from a IpV4
|
int |
getMask() |
int |
hashCode() |
static CIDR |
newCIDR(InetAddress baseAddress,
int cidrMask)
Create CIDR using the CIDR Notation
|
static CIDR |
newCIDR(InetAddress baseAddress,
String scidrMask)
Create CIDR using the normal Notation
|
static CIDR |
newCIDR(String cidr)
Create CIDR using the CIDR or normal Notation
i.e.: CIDR subnet = newCIDR ("10.10.10.0/24"); or CIDR subnet = newCIDR ("1fff:0:0a88:85a3:0:0:ac1f:8001/24"); or CIDR subnet = newCIDR ("10.10.10.0/255.255.255.0"); |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo
protected InetAddress baseAddress
protected int cidrMask
public static CIDR newCIDR(InetAddress baseAddress, int cidrMask) throws UnknownHostException
UnknownHostException
public static CIDR newCIDR(InetAddress baseAddress, String scidrMask) throws UnknownHostException
UnknownHostException
public static CIDR newCIDR(String cidr) throws UnknownHostException
UnknownHostException
public InetAddress getBaseAddress()
public int getMask()
public String toString()
public abstract InetAddress getEndAddress()
public abstract boolean contains(InetAddress inetAddress)
public static byte[] getIpV4FromIpV6(Inet6Address address)
IllegalArgumentException
- if the IpV6 cannot be mapped to IpV4public static byte[] getIpV6FromIpV4(Inet4Address address)
IllegalArgumentException
- if the IpV6 cannot be mapped to IpV4Copyright © 2008-2014 The Netty Project. All Rights Reserved.