Class IPRange
java.lang.Object
com.alibaba.druid.support.http.util.IPRange
This class represents an IP Range, which are represented by an IP address and and a subnet mask. The standards
describing modern routing protocols often refer to the extended-network-prefix-length rather than the subnet mask.
The prefix length is equal to the number of contiguous one-bits in the traditional subnet mask. This means that
specifying the network address 130.5.5.25 with a subnet mask of 255.255.255.0 can also be expressed as 130.5.5.25/24.
The prefix-length notation is more compact and easier to understand than writing out the mask in its traditional
dotted-decimal format.
- Version:
- 1.0
- Author:
- Marcel Dullaart
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Return the extended extended network prefix.final IPAddress
Return the encapsulated IP address.final IPAddress
Return the encapsulated subnet maskboolean
isIPAddressInRange
(IPAddress address) Check if the specified IP address is in the encapsulated range.static String
toDecimalString
(String inBinaryIpAddress) toString()
Convert the IP Range into a string representation.
-
Constructor Details
-
IPRange
-
-
Method Details
-
getIPAddress
Return the encapsulated IP address.- Returns:
- The IP address.
-
getIPSubnetMask
Return the encapsulated subnet mask- Returns:
- The IP range's subnet mask.
-
getExtendedNetworkPrefix
public final int getExtendedNetworkPrefix()Return the extended extended network prefix.- Returns:
- Return the extended network prefix.
-
toString
Convert the IP Range into a string representation. -
toDecimalString
-
isIPAddressInRange
Check if the specified IP address is in the encapsulated range.- Parameters:
address
- The IP address to be tested.- Returns:
- Return
true
if the specified IP address is in the encapsulated IP range, otherwise returnfalse
.
-