public class InetAddressStringParser extends StringParser
StringParser
for parsing java.net.InetAddress objects. The parse() method
delegates the actual
parsing to InetAddress.getByName(String)
. If
InetAddress.getByName()
throws an UnknownHostException, it is encapsulated in a ParseException and
re-thrown.StringParser
,
InetAddress
Constructor and Description |
---|
InetAddressStringParser()
Deprecated.
Use
getParser() or, even better, JSAP.INETADDRESS_PARSER . |
Modifier and Type | Method and Description |
---|---|
static InetAddressStringParser |
getParser()
Returns a
InetAddressStringParser . |
Object |
parse(String arg)
Parses the specified argument into an InetAddress.
|
setUp, tearDown
public InetAddressStringParser()
public static InetAddressStringParser getParser()
InetAddressStringParser
.
Convenient access to the only instance returned by
this method is available through
JSAP.INETADDRESS_PARSER
.
InetAddressStringParser
.public Object parse(String arg) throws ParseException
InetAddress.getByName(arg)
. If
InetAddress.getByName(arg)
throws an UnknownHostException, it is encapsulated in a ParseException
and re-thrown.parse
in class StringParser
arg
- the argument to parseParseException
- if InetAddress.getByName(arg)
throws
an UnknownHostException.InetAddress
,
StringParser.parse(String)
Copyright © 2016. All rights reserved.