public final class CidrAddress extends Object implements Serializable, Comparable<CidrAddress>
Migrate from wildfly-common.jar
| 限定符和类型 | 字段和说明 |
|---|---|
static CidrAddress |
INET4_ANY_CIDR
The CIDR address representing all IPv4 addresses.
|
static CidrAddress |
INET6_ANY_CIDR
The CIDR address representing all IPv6 addresses.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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(InetAddress networkAddress,
int netmaskBits)
Create a new CIDR address.
|
boolean |
equals(CidrAddress obj) |
boolean |
equals(Object obj) |
Inet4Address |
getBroadcastAddress()
Get the broadcast address for this CIDR block.
|
int |
getNetmaskBits()
Get the netmask bits.
|
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(CidrAddress address)
Determine if this CIDR address matches the given CIDR address.
|
boolean |
matches(Inet4Address address)
Determine if this CIDR address matches the given address.
|
boolean |
matches(Inet6Address address)
Determine if this CIDR address matches the given address.
|
boolean |
matches(InetAddress address)
Determine if this CIDR address matches the given address.
|
String |
toString() |
public static final CidrAddress INET4_ANY_CIDR
public static final CidrAddress INET6_ANY_CIDR
public static CidrAddress create(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(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(Inet4Address address)
address - the address to testtrue if the address matches, false otherwisepublic boolean matches(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 InetAddress getNetworkAddress()
null)public Inet4Address getBroadcastAddress()
null is returned.null if there is nonepublic int getNetmaskBits()
public int getScopeId()
public int compareTo(CidrAddress other)
compareTo 在接口中 Comparable<CidrAddress>public int compareAddressBytesTo(byte[] otherBytes,
int otherNetmaskBits,
int scopeId)
public boolean equals(CidrAddress obj)
Copyright © 2022. All rights reserved.