@PublicEvolving public class ShortParser extends FieldParser<Short>
Short
. Only characters '1' to '0' and '-' are allowed.
The parser does not check for the maximum value.FieldParser.ParseErrorState
Constructor and Description |
---|
ShortParser() |
Modifier and Type | Method and Description |
---|---|
Short |
createValue()
Returns an instance of the parsed value type.
|
Short |
getLastResult()
Gets the parsed field.
|
static short |
parseField(byte[] bytes,
int startPos,
int length)
Static utility to parse a field of type short from a byte sequence that represents text
characters (such as when read from a file stream).
|
int |
parseField(byte[] bytes,
int startPos,
int limit,
byte[] delimiter,
Short reusable)
Each parser's logic should be implemented inside this method
|
static short |
parseField(byte[] bytes,
int startPos,
int length,
char delimiter)
Static utility to parse a field of type short from a byte sequence that represents text
characters (such as when read from a file stream).
|
delimiterNext, endsWithDelimiter, getCharset, getErrorState, getParserForType, nextStringEndPos, nextStringLength, resetErrorStateAndParse, resetParserState, setCharset, setErrorState
public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, Short reusable)
FieldParser
parseField
in class FieldParser<Short>
public Short createValue()
FieldParser
createValue
in class FieldParser<Short>
public Short getLastResult()
FieldParser
FieldParser.parseField(byte[], int, int, byte[], Object)
. It objects are mutable and reused,
it will return the object instance that was passed the parse function.getLastResult
in class FieldParser<Short>
public static final short parseField(byte[] bytes, int startPos, int length)
bytes
- The bytes containing the text data that should be parsed.startPos
- The offset to start the parsing.length
- The length of the byte sequence (counting from the offset).NumberFormatException
- Thrown when the value cannot be parsed because the text
represents not a correct number.public static final short parseField(byte[] bytes, int startPos, int length, char delimiter)
bytes
- The bytes containing the text data that should be parsed.startPos
- The offset to start the parsing.length
- The length of the byte sequence (counting from the offset).delimiter
- The delimiter that terminates the field.NumberFormatException
- Thrown when the value cannot be parsed because the text
represents not a correct number.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.