public class IPRange extends Object implements Iterable<IP>, Serializable
IPRange
represents an IPrange.Constructor and Description |
---|
IPRange(IP startIp,
IP endIp)
Constructs a
IpRange instance by given tow IP. |
Modifier and Type | Method and Description |
---|---|
static IPRange |
AClassLocalIPRange()
Gets A class IP range.
|
static IPRange |
BClassLocalIPRange()
Gets B class IP range.
|
static IPRange |
CClassLocalIPRange()
Gets C class IP range.
|
boolean |
contains(IP ip)
Returns
true if the given IP is in the IP range. |
boolean |
equals(Object obj) |
IP |
getEndIP()
Returns end IP address.
|
IP |
getStartIP()
Returns starting IP address.
|
int |
hashCode() |
Iterator<IP> |
iterator() |
static IPRange |
parseFromIPWithMask(String ipWithMask)
Creates a
IPRange instance by IP with mask. |
static IPRange |
parseFromString(String range)
Creates a
IpRange instance by a string. |
long |
size()
Returns size of IP range.
|
List<IPRange> |
split(IP ip)
Split IP address range by a IP address.
|
String |
toString() |
public static IPRange parseFromString(String range)
IpRange
instance by a string.range
- a string such as "1.1.1.1-1.1.2.255".public static IPRange parseFromIPWithMask(String ipWithMask)
IPRange
instance by IP with mask.ipWithMask
- IP/mask, such as 192.168.70.1/24IPRange
instancepublic static IPRange AClassLocalIPRange()
public static IPRange BClassLocalIPRange()
public static IPRange CClassLocalIPRange()
public boolean contains(IP ip)
true
if the given IP is in the IP range.ip
- IP.true
.public long size()
public IP getStartIP()
public IP getEndIP()
public List<IPRange> split(IP ip)
ip
- IP address. IP address range should contains the IP address.Copyright © 2015. All rights reserved.