Class URLStringParser

java.lang.Object
com.martiansoftware.jsap.StringParser
com.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

    Constructors
    Constructor Description
    URLStringParser()
    Deprecated.
    Use getParser() or, even better, JSAP.URL_PARSER.
  • Method Summary

    Modifier and Type Method Description
    static URLStringParser getParser()
    Returns a URLStringParser.
    java.lang.Object parse​(java.lang.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 Details

    • URLStringParser

      public URLStringParser()
      Deprecated.
      Use getParser() or, even better, JSAP.URL_PARSER.
      Creates a new URLStringParser.
  • Method Details

    • 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 java.lang.Object parse​(java.lang.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)