com.martiansoftware.jsap.stringparsers
Class ByteStringParser

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

public class ByteStringParser
extends StringParser

A StringParser for parsing Bytes. The parse() method delegates the actual parsing to Byte.decode(String).

Author:
Marty Lamb
See Also:
StringParser, Byte

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

ByteStringParser

public ByteStringParser()
Deprecated. Use getParser() or, even better, JSAP.BYTE_PARSER.

Creates a new ByteStringParser.

Method Detail

getParser

public static ByteStringParser getParser()
Returns a ByteStringParser.

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

Returns:
a ByteStringParser.

parse

public Object parse(String arg)
             throws ParseException
Parses the specified argument into a Byte. This method simply delegates the parsing to Byte.decode(String). If Byte throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.

Specified by:
parse in class StringParser
Parameters:
arg - the argument to parse
Returns:
a Byte object with the value contained in the specified argument.
Throws:
ParseException - if Byte.decode(arg) throws a NumberFormatException.
See Also:
Byte, 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