public class SubnetUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
SubnetUtils.SubnetInfo
Convenience container for subnet summary information.
|
Constructor and Description |
---|
SubnetUtils(java.lang.String cidrNotation)
Constructor that takes a CIDR-notation string, e.g.
|
SubnetUtils(java.lang.String address,
java.lang.String mask)
Constructor that takes a dotted decimal address and a dotted decimal
mask.
|
Modifier and Type | Method and Description |
---|---|
SubnetUtils.SubnetInfo |
getInfo()
Return a
SubnetUtils.SubnetInfo instance that contains subnet-specific
statistics |
boolean |
isInclusiveHostCount()
Returns
true if the return value of
SubnetUtils.SubnetInfo.getAddressCount() includes the network address and
broadcast addresses. |
void |
setInclusiveHostCount(boolean inclusiveHostCount)
Set to
true if you want the return value of
SubnetUtils.SubnetInfo.getAddressCount() to include the network and broadcast
addresses. |
public SubnetUtils(java.lang.String cidrNotation)
cidrNotation
- A CIDR-notation string, e.g. "192.168.0.1/16"java.lang.IllegalArgumentException
- if the parameter is invalid, i.e. does not match n.n.n.n/m
where n=1-3 decimal digits, m = 1-3 decimal digits in range
1-32public SubnetUtils(java.lang.String address, java.lang.String mask)
address
- An IP address, e.g. "192.168.0.1"mask
- A dotted decimal netmask e.g. "255.255.0.0"java.lang.IllegalArgumentException
- if the address or mask is invalid, i.e. does not match
n.n.n.n where n=1-3 decimal digits and the mask is not all
zerospublic boolean isInclusiveHostCount()
true
if the return value of
SubnetUtils.SubnetInfo.getAddressCount()
includes the network address and
broadcast addresses.public void setInclusiveHostCount(boolean inclusiveHostCount)
true
if you want the return value of
SubnetUtils.SubnetInfo.getAddressCount()
to include the network and broadcast
addresses.inclusiveHostCount
- public final SubnetUtils.SubnetInfo getInfo()
SubnetUtils.SubnetInfo
instance that contains subnet-specific
statisticsCopyright © 2021. All Rights Reserved.