java.io.Serializable, java.lang.Comparable<CidrAddress>public final class CidrAddress extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<CidrAddress>
| Modifier and Type | Field | 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 | Description |
|---|---|---|
int |
compareAddressBytesTo(byte[] otherBytes,
int otherNetmaskBits,
int scopeId) |
|
int |
compareTo(CidrAddress other) |
|
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(java.lang.Object obj) |
|
boolean |
equals(CidrAddress 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 |
getScopeId() |
Get the match address scope ID (if it is an IPv6 address).
|
int |
hashCode() |
|
boolean |
matches(byte[] bytes) |
Determine if this CIDR address matches the given address bytes.
|
boolean |
matches(byte[] bytes,
int scopeId) |
Determine if this CIDR address matches the given address bytes.
|
boolean |
matches(java.net.Inet4Address address) |
Determine if this CIDR address matches the given address.
|
boolean |
matches(java.net.Inet6Address address) |
Determine if this CIDR address matches the given address.
|
boolean |
matches(java.net.InetAddress address) |
Determine if this CIDR address matches the given address.
|
boolean |
matches(CidrAddress address) |
Determine if this CIDR address matches the given 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 matches(java.net.InetAddress address)
address - the address to testtrue if the address matches, false otherwisepublic boolean matches(byte[] bytes)
bytes - the address bytes to testtrue if the address bytes match, false otherwisepublic boolean matches(byte[] bytes,
int scopeId)
bytes - the address bytes to testscopeId - the scope ID, or 0 to match no scopetrue if the address bytes match, false otherwisepublic boolean matches(java.net.Inet4Address address)
address - the address to testtrue if the address matches, false otherwisepublic boolean matches(java.net.Inet6Address address)
address - the address to testtrue if the address matches, false otherwisepublic boolean matches(CidrAddress address)
address - the address to testtrue if the given block is enclosed by this one, false otherwisepublic java.net.InetAddress getNetworkAddress()
null)public java.net.Inet4Address getBroadcastAddress()
null is returned.null if there is nonepublic int getNetmaskBits()
public int getScopeId()
public int compareTo(CidrAddress other)
compareTo in interface java.lang.Comparable<CidrAddress>public int compareAddressBytesTo(byte[] otherBytes,
int otherNetmaskBits,
int scopeId)
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 © 2018 JBoss, a division of Red Hat, Inc.