com.martiansoftware.jsap.stringparsers
Class InetAddressStringParser

java.lang.Object
  extended bycom.martiansoftware.jsap.StringParser
      extended bycom.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
InetAddressStringParser()
          Deprecated. Use getParser() or, even better, JSAP.INETADDRESS_PARSER.
 
Method Summary
static InetAddressStringParser getParser()
          Returns a InetAddressStringParser.
 Object parse(String arg)
          Parses the specified argument into an InetAddress.
 
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InetAddressStringParser

public InetAddressStringParser()
Deprecated. Use getParser() or, even better, JSAP.INETADDRESS_PARSER.

Creates a new InetAddressStringParser.

Method Detail

getParser

public static InetAddressStringParser getParser()
Returns a InetAddressStringParser.

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 to InetAddress.getByName(arg). If InetAddress.getByName(arg) throws an UnknownHostException, it is encapsulated in a ParseException and re-thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
an InetAddress object representing the specified address.
Throws:
ParseException - if InetAddress.getByName(arg) throws an UnknownHostException.
See Also:
InetAddress, StringParser.parse(String)


Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap