Class ByteStringParser
- java.lang.Object
-
- com.martiansoftware.jsap.StringParser
-
- com.martiansoftware.jsap.stringparsers.ByteStringParser
-
public class ByteStringParser extends StringParser
AStringParser
for parsing Bytes. The parse() method delegates the actual parsing to Byte.decode(String).- Author:
- Marty Lamb
- See Also:
StringParser
,Byte
-
-
Constructor Summary
Constructors Constructor Description ByteStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.BYTE_PARSER
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ByteStringParser
getParser()
Returns aByteStringParser
.Object
parse(String arg)
Parses the specified argument into a Byte.-
Methods inherited from class com.martiansoftware.jsap.StringParser
setUp, tearDown
-
-
-
-
Constructor Detail
-
ByteStringParser
public ByteStringParser()
Deprecated.UsegetParser()
or, even better,JSAP.BYTE_PARSER
.Creates a new ByteStringParser.
-
-
Method Detail
-
getParser
public static ByteStringParser getParser()
Returns aByteStringParser
.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 toByte.decode(String)
. If Byte throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.- Specified by:
parse
in classStringParser
- Parameters:
arg
- the argument to parse- Returns:
- a Byte object with the value contained in the specified argument.
- Throws:
ParseException
- ifByte.decode(arg)
throws a NumberFormatException.- See Also:
Byte
,StringParser.parse(String)
-
-