Package org.apache.commons.net.util
Class SubnetUtils.SubnetInfo
java.lang.Object
org.apache.commons.net.util.SubnetUtils.SubnetInfo
- Enclosing class:
- SubnetUtils
Convenience container for subnet summary information.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
address()
int
private int
private long
int
Deprecated.long
Get the count of available addresses.String[]
Return the high address as a dotted IP address.Return the low address as a dotted IP address.private int
high()
boolean
isInRange
(int address) boolean
Returns true if the parameteraddress
is in the range of usable endpoint addresses for this subnet.private int
low()
private int
netmask()
private int
network()
private long
toString()
-
Field Details
-
UNSIGNED_INT_MASK
private static final long UNSIGNED_INT_MASK- See Also:
-
-
Constructor Details
-
SubnetInfo
private SubnetInfo()
-
-
Method Details
-
netmask
private int netmask() -
network
private int network() -
address
private int address() -
broadcast
private int broadcast() -
networkLong
private long networkLong() -
broadcastLong
private long broadcastLong() -
low
private int low() -
high
private int high() -
isInRange
Returns true if the parameteraddress
is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast adresses.- Parameters:
address
- A dot-delimited IPv4 address, e.g. "192.168.0.1"- Returns:
- True if in range, false otherwise
-
isInRange
public boolean isInRange(int address) - Parameters:
address
- the address to check- Returns:
- true if it is in range
- Since:
- 3.4 (made public)
-
getBroadcastAddress
-
getNetworkAddress
-
getNetmask
-
getAddress
-
getLowAddress
Return the low address as a dotted IP address. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.- Returns:
- the IP address in dotted format, may be "0.0.0.0" if there is no valid address
-
getHighAddress
Return the high address as a dotted IP address. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.- Returns:
- the IP address in dotted format, may be "0.0.0.0" if there is no valid address
-
getAddressCount
Deprecated.(3.4) usegetAddressCountLong()
insteadGet the count of available addresses. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.- Returns:
- the count of addresses, may be zero.
- Throws:
RuntimeException
- if the correct count is greater thanInteger.MAX_VALUE
-
getAddressCountLong
public long getAddressCountLong()Get the count of available addresses. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.- Returns:
- the count of addresses, may be zero.
- Since:
- 3.4
-
asInteger
-
getCidrSignature
-
getAllAddresses
-
toString
-
getAddressCountLong()
instead