Interface JsopReader
- 
- All Known Implementing Classes:
 JsopStream,JsopTokenizer
public interface JsopReaderA reader for Json and Jsop strings. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intCOMMENTThe token type of a comment, if supported by the reader.static intENDThe token type that signals the end of the stream.static intERRORThe token type of a parse error.static intFALSEThe token type of the value "false".static intIDENTIFIERThe token type of an identifier (an unquoted string), if supported by the reader.static intNULLThe token type of "null".static intNUMBERThe token type of a number value.static intSTRINGThe token type of a string value.static intTRUEThe token type of the value "true". 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable java.lang.StringgetToken()Get the last token value if the the token type was STRING or NUMBER.intgetTokenType()Get the token type of the last token.booleanmatches(int type)Read a token which must match a given token type.intread()Read a token and return the token type.java.lang.Stringread(int type)Read a token which must match a given token type.@Nullable java.lang.StringreadRawValue()Return the row (escaped) token.@Nullable java.lang.StringreadString()Read a string.voidresetReader()Reset the position to 0, so that to restart reading. 
 - 
 
- 
- 
Field Detail
- 
END
static final int END
The token type that signals the end of the stream.- See Also:
 - Constant Field Values
 
 
- 
STRING
static final int STRING
The token type of a string value.- See Also:
 - Constant Field Values
 
 
- 
NUMBER
static final int NUMBER
The token type of a number value.- See Also:
 - Constant Field Values
 
 
- 
TRUE
static final int TRUE
The token type of the value "true".- See Also:
 - Constant Field Values
 
 
- 
FALSE
static final int FALSE
The token type of the value "false".- See Also:
 - Constant Field Values
 
 
- 
NULL
static final int NULL
The token type of "null".- See Also:
 - Constant Field Values
 
 
- 
ERROR
static final int ERROR
The token type of a parse error.- See Also:
 - Constant Field Values
 
 
- 
IDENTIFIER
static final int IDENTIFIER
The token type of an identifier (an unquoted string), if supported by the reader.- See Also:
 - Constant Field Values
 
 
- 
COMMENT
static final int COMMENT
The token type of a comment, if supported by the reader.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
read
java.lang.String read(int type)
Read a token which must match a given token type.- Parameters:
 type- the token type- Returns:
 - the token (null when reading a null value)
 - Throws:
 java.lang.IllegalStateException- if the token type doesn't match
 
- 
readString
@Nullable @Nullable java.lang.String readString()
Read a string.- Returns:
 - the de-escaped string (null when reading a null value)
 - Throws:
 java.lang.IllegalStateException- if the token type doesn't match
 
- 
read
int read()
Read a token and return the token type.- Returns:
 - the token type
 
 
- 
matches
boolean matches(int type)
Read a token which must match a given token type.- Parameters:
 type- the token type- Returns:
 - true if there was a match
 
 
- 
readRawValue
@Nullable @Nullable java.lang.String readRawValue()
Return the row (escaped) token.- Returns:
 - the escaped string (null when reading a null value)
 
 
- 
getToken
@Nullable @Nullable java.lang.String getToken()
Get the last token value if the the token type was STRING or NUMBER. For STRING, the text is decoded; for NUMBER, it is returned as parsed. In all other cases the result is undefined.- Returns:
 - the token
 
 
- 
getTokenType
int getTokenType()
Get the token type of the last token. The token type is one of the known types (END, STRING, NUMBER,...), or, for Jsop tags such as "+", "-", it is the Unicode character code of the tag.- Returns:
 - the token type
 
 
- 
resetReader
void resetReader()
Reset the position to 0, so that to restart reading. 
 - 
 
 -