Package org.apache.commons.net.util
Class SubnetUtils.SubnetInfo
- java.lang.Object
-
- org.apache.commons.net.util.SubnetUtils.SubnetInfo
-
- Enclosing class:
- SubnetUtils
public final class SubnetUtils.SubnetInfo extends java.lang.Object
Convenience container for subnet summary information.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
asInteger(java.lang.String address)
java.lang.String
getAddress()
int
getAddressCount()
Deprecated.(3.4) usegetAddressCountLong()
insteadlong
getAddressCountLong()
Get the count of available addresses.java.lang.String[]
getAllAddresses()
java.lang.String
getBroadcastAddress()
java.lang.String
getCidrSignature()
java.lang.String
getHighAddress()
Return the high address as a dotted IP address.java.lang.String
getLowAddress()
Return the low address as a dotted IP address.java.lang.String
getNetmask()
java.lang.String
getNetworkAddress()
boolean
isInRange(int address)
boolean
isInRange(java.lang.String address)
Returns true if the parameteraddress
is in the range of usable endpoint addresses for this subnet.java.lang.String
toString()
-
-
-
Method Detail
-
isInRange
public boolean isInRange(java.lang.String address)
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
public java.lang.String getBroadcastAddress()
-
getNetworkAddress
public java.lang.String getNetworkAddress()
-
getNetmask
public java.lang.String getNetmask()
-
getAddress
public java.lang.String getAddress()
-
getLowAddress
public java.lang.String 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
public java.lang.String 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 public int 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:
java.lang.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
public int asInteger(java.lang.String address)
-
getCidrSignature
public java.lang.String getCidrSignature()
-
getAllAddresses
public java.lang.String[] getAllAddresses()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Since:
- 2.2
-
-