public class IPRange extends Object
130.5.5.25
10000010 . 00000101 . 00000101 . 00011001
255.255.255.0
11111111 . 11111111 . 11111111 . 00000000
<--extended-network-prefix -->
or
130.5.5.25/24
10000010 . 00000101 . 00000101 . 00011001
IPAddress
构造器和说明 |
---|
IPRange(IPAddress ipAddress,
int extendedNetworkPrefix)
Constructor.
|
IPRange(IPAddress ipAddress,
IPAddress subnetMask)
Constructor.
|
IPRange(String range)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
equals(Object another)
Compare the specified IP range to the encapsulated one.
|
int |
getExtendedNetworkPrefix()
Return the extended extended network prefix.
|
IPAddress |
getIPAddress()
Return the encapsulated IP address.
|
IPAddress |
getIPSubnetMask()
Return the encapsulated subnet mask
|
int |
hashCode() |
boolean |
isIPAddressInRange(IPAddress address)
Check if the specified IP address is in the encapsulated range.
|
static String |
toDecimalString(String inBinaryIpAddress) |
String |
toString()
Convert the IP Range into a string representation.
|
public IPRange(String range)
ip
- String representation of the IP address. The two following formats are supported :InvalidIPRangeException
- Throws this exception when the specified string doesn't represent a valid IP
address.public IPRange(IPAddress ipAddress, IPAddress subnetMask)
ipAddress
- Reference to the IP address numbersubnetMask
- Reference to the subnet maskInvalidIPRangeException
- Throws this exception when the combination of the IP address and the subnet
mask does not define a valid IP range.InvalidIPAddressException
- Throws this exception if the specified IP address or subnet mask do ne
define a valid IP number.public IPRange(IPAddress ipAddress, int extendedNetworkPrefix)
ipAddress
- The reference on the IP address.extendedNetworkPrefix
- The extended network prefix (0-32).public final IPAddress getIPAddress()
public final IPAddress getIPSubnetMask()
public final int getExtendedNetworkPrefix()
public String toString()
public boolean equals(Object another)
public boolean isIPAddressInRange(IPAddress address)
address
- The IP address to be tested.true
if the specified IP address is in the encapsulated IP range, otherwise return
false
.Copyright © 2012 Alibaba Group. All Rights Reserved.