com.martiansoftware.jsap.stringparsers
Class URLStringParser

java.lang.Object
  extended bycom.martiansoftware.jsap.StringParser
      extended bycom.martiansoftware.jsap.stringparsers.URLStringParser

public class URLStringParser
extends StringParser

A StringParser for parsing java.net.URL objects. The parse() method delegates the actual parsing to new URL(String). If new URL() throws a MalformedURLException, it is encapsulated in a ParseException and re-thrown.

Author:
Marty Lamb
See Also:
StringParser, URL

Constructor Summary
URLStringParser()
          Deprecated. Use getParser() or, even better, JSAP.URL_PARSER.
 
Method Summary
static URLStringParser getParser()
          Returns a URLStringParser.
 Object parse(String arg)
          Parses the specified argument into a URL.
 
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

URLStringParser

public URLStringParser()
Deprecated. Use getParser() or, even better, JSAP.URL_PARSER.

Creates a new URLStringParser.

Method Detail

getParser

public static URLStringParser getParser()
Returns a URLStringParser.

Convenient access to the only instance returned by this method is available through JSAP.URL_PARSER.

Returns:
a URLStringParser.

parse

public Object parse(String arg)
             throws ParseException
Parses the specified argument into a URL. This method delegates the actual parsing to new URL(arg). If new URL(arg) throws a MalformedURLException, it is encapsulated in a ParseException and re-thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a URL as specified by arg.
Throws:
ParseException - if new URL(arg) throws a MalformedURLException.
See Also:
URL, 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