Class InetAddressStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.InetAddressStringParser
A
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.- Author:
- Marty Lamb
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InetAddressStringParserReturns aInetAddressStringParser.Parses the specified argument into an InetAddress.Methods inherited from class StringParser
setUp, tearDown
-
Constructor Details
-
InetAddressStringParser
public InetAddressStringParser()Deprecated.UsegetParser()or, even better,JSAP.INETADDRESS_PARSER.Creates a new InetAddressStringParser.
-
-
Method Details
-
getParser
Returns aInetAddressStringParser.Convenient access to the only instance returned by this method is available through
JSAP.INETADDRESS_PARSER.- Returns:
- a
InetAddressStringParser.
-
parse
Parses the specified argument into an InetAddress. This method delegates the actual parsing toInetAddress.getByName(arg). IfInetAddress.getByName(arg)throws an UnknownHostException, it is encapsulated in a ParseException and re-thrown.- Specified by:
parsein classStringParser- Parameters:
arg- the argument to parse- Returns:
- an InetAddress object representing the specified address.
- Throws:
ParseException- ifInetAddress.getByName(arg)throws an UnknownHostException.- See Also:
-
getParser()or, even better,JSAP.INETADDRESS_PARSER.