|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.n52.security.common.ip.IPRangeParser
public class IPRangeParser
Utilities to convert between IPRange
instances and their human-readable string representation.
Supported formats (whitespaces are trimmed automatically):
172.12.25.84
172.12.25.0/24
172.12.25.10-172.12.25.20
Constructor Summary | |
---|---|
IPRangeParser()
|
Method Summary | |
---|---|
static String |
encodeRangesAsString(Iterable<IPRange> ranges,
String delimeter)
|
static IPRange |
parseIntervalRange(String intervalRange)
Parses an interval of IP addresses, specified as string, where upper and lower bounds are separated with a dash ('-'). |
static IPRange |
parseIP4AddressMask(String addressMask)
Parses a IP address mask defining a subnet of IP addresses defined by a base IP address amd a prefix length. |
static IPRange |
parseRange(String range)
Converts a string that is either a single IP address, a subnet mask, or an interval of IP adresses. |
static Collection<IPRange> |
parseRanges(String ranges,
String delimeter)
Parses a list of IP address range specifications. |
static InetAddress |
parseSingleAddress(String address)
Convert an IP address specified as a string. |
static IPRange |
toRange(InetAddress address)
|
static IPRange |
toRange(InetAddress lower,
InetAddress upper)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IPRangeParser()
Method Detail |
---|
public static IPRange parseRange(String range) throws IPRangeParseException
range
- a range in one of the formats described above.
IPIntervalRange
for single address or interval and
IP4AddressMask
for a subnet mask.
IPRangeParseException
- if IP address is malformed or doesn't follow the format described above.public static IPRange parseIntervalRange(String intervalRange) throws IPRangeParseException
intervalRange
- defninition of interval.
IPRangeParseException
public static IPRange parseIP4AddressMask(String addressMask) throws IPRangeParseException
IP4AddressMask
for a detailed description.
addressMask
- the IP address mask that should be parsed.
IPRangeParseException
public static IPRange toRange(InetAddress address)
public static IPRange toRange(InetAddress lower, InetAddress upper)
public static InetAddress parseSingleAddress(String address) throws IPRangeParseException
address
- the IP address.
IPRangeParseException
public static Collection<IPRange> parseRanges(String ranges, String delimeter) throws IPRangeParseException
ranges
- the string containing a list of IP range specfications.delimeter
- delimiter that shall be used to identify the single IP range specifications, e.g. ","
.
IPRangeParseException
public static String encodeRangesAsString(Iterable<IPRange> ranges, String delimeter)
ranges
- a list of IPRange
instances.delimeter
- delimiter that shall be used to separate the different IP ranges.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |