public class JsopTokenizer extends Object implements JsopReader
COMMENT, END, ERROR, FALSE, IDENTIFIER, NULL, NUMBER, STRING, TRUE| Constructor and Description |
|---|
JsopTokenizer(String json) |
JsopTokenizer(String json,
int pos) |
| Modifier and Type | Method and Description |
|---|---|
static String |
decode(String s)
Decode a Json string.
|
static String |
decodeQuoted(String s)
Decode a quoted Json string.
|
String |
getEscapedToken()
Get the last encoded (raw) string, including escape sequences.
|
int |
getLastPos() |
int |
getPos() |
String |
getToken()
Get the last token value if the the token type was STRING or NUMBER.
|
int |
getTokenType()
Get the token type of the last token.
|
boolean |
matches(int type)
Read a token which must match a given token type.
|
int |
read()
Read a token and return the token type.
|
String |
read(int type)
Read a token which must match a given token type.
|
String |
readRawValue()
Read a value and return the raw Json representation.
|
String |
readString()
Read a string.
|
void |
resetReader()
Reset the position to 0, so that to restart reading.
|
void |
setPos(int pos) |
String |
toString() |
public JsopTokenizer(String json, int pos)
public JsopTokenizer(String json)
public void resetReader()
JsopReaderresetReader in interface JsopReaderpublic int getTokenType()
getTokenType in interface JsopReaderpublic String getToken()
getToken in interface JsopReaderpublic String getEscapedToken()
public String read(int type)
read in interface JsopReadertype - the token typeIllegalStateException - if the token type doesn't matchpublic String readString()
readString in interface JsopReaderIllegalStateException - if the token type doesn't matchpublic boolean matches(int type)
matches in interface JsopReadertype - the token typepublic int read()
read in interface JsopReaderpublic static String decodeQuoted(String s)
s - the encoded string, with double quotespublic static String decode(String s)
s - the encoded string, without double quotespublic String readRawValue()
readRawValue in interface JsopReaderpublic int getPos()
public int getLastPos()
public void setPos(int pos)
Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.