Class InetAddressStringParser
java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.InetAddressStringParser
public class InetAddressStringParser extends StringParser
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:
StringParser,InetAddress
-
Constructor Summary
Constructors Constructor Description InetAddressStringParser()Deprecated. -
Method Summary
Modifier and Type Method Description static InetAddressStringParsergetParser()Returns aInetAddressStringParser.java.lang.Objectparse(java.lang.String arg)Parses the specified argument into an InetAddress.Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDownMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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:
InetAddress,StringParser.parse(String)
-
getParser()or, even better,JSAP.INETADDRESS_PARSER.