public final class IpUtils extends Object
IP addresses.| Modifier and Type | Field and Description |
|---|---|
protected static String |
COUNT_GE_ONE
Exception Message: count must be greater than 1
|
| Modifier and Type | Method and Description |
|---|---|
static List<IpAddress> |
getRandomIps(IpRange range,
int count)
Returns a list of randomly generated IP addresses.
|
static List<IpAddress> |
getRandomIps(String spec,
int count)
Returns a list of randomly generated IP addresses.
|
static IpAddress |
getRepeatedByteIpAddressV4(int seed)
Returns an IPv4 address where all the bytes are set to the specified
seed value.
|
static IpAddress |
getRepeatedByteIpAddressV6(int seed)
Returns an IPv6 address where all the bytes are set to the specified
seed value.
|
protected static final String COUNT_GE_ONE
public static IpAddress getRepeatedByteIpAddressV4(int seed)
IpAddress ip = IpUtils.getRepeatedByteIpAddressV4(5);will return the IP address
5.5.5.5seed - the seed valueIllegalArgumentException - if seed is not in the range 0..255public static IpAddress getRepeatedByteIpAddressV6(int seed)
IpAddress ip = IpUtils.getRepeatedByteIpAddressV6(15);will return the IP address
F0F:F0F:F0F:F0F:F0F:F0F:F0F:F0Fseed - the seed valueIllegalArgumentException - if seed is not in the range 0..255public static List<IpAddress> getRandomIps(String spec, int count)
IpRange for a definition of the range specification.
Note that addresses may be repeated in the list.spec - a string defining the set of IP addresses from which to
draw the random samplescount - the number of IP addresses to return in the listIllegalArgumentException - if count is less than 1 or if the
spec is ill-formedNullPointerException - if spec is nullpublic static List<IpAddress> getRandomIps(IpRange range, int count)
range - an IP address range from which to draw the random samplescount - the number of IP addresses to return in the listIllegalArgumentException - if count is less than 1Copyright © 2014. All Rights Reserved.