public final class CidrAddress
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static CidrAddress |
INET4_ANY_CIDR
The CIDR address representing all IPv4 addresses.
|
static CidrAddress |
INET6_ANY_CIDR
The CIDR address representing all IPv6 addresses.
|
| Modifier and Type | Method and Description |
|---|---|
static CidrAddress |
create(byte[] addressBytes,
int netmaskBits)
Create a new CIDR address.
|
static CidrAddress |
create(java.net.InetAddress networkAddress,
int netmaskBits)
Create a new CIDR address.
|
boolean |
equals(CidrAddress obj) |
boolean |
equals(java.lang.Object obj) |
java.net.Inet4Address |
getBroadcastAddress()
Get the broadcast address for this CIDR block.
|
int |
getNetmaskBits()
Get the netmask bits.
|
java.net.InetAddress |
getNetworkAddress()
Get the network address.
|
int |
hashCode() |
boolean |
isMatchedBy(java.net.Inet4Address address)
Determine if the given address matches this CIDR address.
|
boolean |
isMatchedBy(java.net.Inet6Address address)
Determine if the given address matches this CIDR address.
|
boolean |
isMatchedBy(java.net.InetAddress address)
Determine if the given address matches this CIDR address.
|
java.lang.String |
toString() |
public static final CidrAddress INET4_ANY_CIDR
public static final CidrAddress INET6_ANY_CIDR
public static CidrAddress create(java.net.InetAddress networkAddress, int netmaskBits)
networkAddress - the network address (must not be null)netmaskBits - the netmask bits (0-32 for IPv4, or 0-128 for IPv6)null)public static CidrAddress create(byte[] addressBytes, int netmaskBits)
addressBytes - the network address bytes (must not be null, must be 4 bytes for IPv4 or 16 bytes for IPv6)netmaskBits - the netmask bits (0-32 for IPv4, or 0-128 for IPv6)null)public boolean isMatchedBy(java.net.InetAddress address)
address - the address to testtrue if the address matches, false otherwisepublic boolean isMatchedBy(java.net.Inet4Address address)
address - the address to testtrue if the address matches, false otherwisepublic boolean isMatchedBy(java.net.Inet6Address address)
address - the address to testtrue if the address matches, false otherwisepublic java.net.InetAddress getNetworkAddress()
null)public java.net.Inet4Address getBroadcastAddress()
null is returned.null if there is nonepublic int getNetmaskBits()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean equals(CidrAddress obj)
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2015 JBoss, a division of Red Hat, Inc.