Package org.htmlunit.util
Class SubnetUtils
java.lang.Object
org.htmlunit.util.SubnetUtils
Performs subnet calculations given a network address and a subnet mask.
Inspired by org.apache.commons.net.util.SubnetUtils.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSubnetUtils
(String address, String mask) Constructs an instance from a dotted decimal address and a dotted decimal mask. -
Method Summary
-
Constructor Details
-
SubnetUtils
Constructs an instance from a dotted decimal address and a dotted decimal mask.- Parameters:
address
- An IP address, e.g. "192.168.0.1"mask
- A dotted decimal netmask e.g. "255.255.0.0"- Throws:
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 zeros
-
-
Method Details
-
isInRange
Tests if the parameteraddress
is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast addresses.- Parameters:
address
- A dot-delimited IPv4 address, e.g. "192.168.0.1"- Returns:
- true if in range, false otherwise
-