Class InetAddressStringParser
- java.lang.Object
-
- com.martiansoftware.jsap.StringParser
-
- com.martiansoftware.jsap.stringparsers.InetAddressStringParser
-
public class InetAddressStringParser extends StringParser
AStringParserfor parsing java.net.InetAddress objects. The parse() method delegates the actual parsing toInetAddress.getByName(String). IfInetAddress.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.UsegetParser()or, even better,JSAP.INETADDRESS_PARSER.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InetAddressStringParsergetParser()Returns aInetAddressStringParser.Objectparse(String arg)Parses the specified argument into an InetAddress.-
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
-
-
-
Constructor Detail
-
InetAddressStringParser
public InetAddressStringParser()
Deprecated.UsegetParser()or, even better,JSAP.INETADDRESS_PARSER.Creates a new InetAddressStringParser.
-
-
Method Detail
-
getParser
public static InetAddressStringParser getParser()
Returns aInetAddressStringParser.Convenient access to the only instance returned by this method is available through
JSAP.INETADDRESS_PARSER.- Returns:
- a
InetAddressStringParser.
-
parse
public Object parse(String arg) throws ParseException
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)
-
-