public class JsopTokenizer extends java.lang.Object implements JsopReader
COMMENT, END, ERROR, FALSE, IDENTIFIER, NULL, NUMBER, STRING, TRUE
Constructor and Description |
---|
JsopTokenizer(java.lang.String json) |
JsopTokenizer(java.lang.String json,
int pos) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decode(java.lang.String s)
Decode a Json string.
|
static java.lang.String |
decodeQuoted(java.lang.String s)
Decode a quoted Json string.
|
java.lang.String |
getEscapedToken()
Get the last encoded (raw) string, including escape sequences.
|
int |
getLastPos() |
int |
getPos() |
java.lang.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.
|
java.lang.String |
read(int type)
Read a token which must match a given token type.
|
java.lang.String |
readRawValue()
Read a value and return the raw Json representation.
|
java.lang.String |
readString()
Read a string.
|
void |
resetReader()
Reset the position to 0, so that to restart reading.
|
void |
setPos(int pos) |
java.lang.String |
toString() |
public JsopTokenizer(java.lang.String json, int pos)
public JsopTokenizer(java.lang.String json)
public void resetReader()
JsopReader
resetReader
in interface JsopReader
public java.lang.String toString()
toString
in class java.lang.Object
public int getTokenType()
getTokenType
in interface JsopReader
public java.lang.String getToken()
getToken
in interface JsopReader
public java.lang.String getEscapedToken()
public java.lang.String read(int type)
read
in interface JsopReader
type
- the token typejava.lang.IllegalStateException
- if the token type doesn't matchpublic java.lang.String readString()
readString
in interface JsopReader
java.lang.IllegalStateException
- if the token type doesn't matchpublic boolean matches(int type)
matches
in interface JsopReader
type
- the token typepublic int read()
read
in interface JsopReader
public static java.lang.String decodeQuoted(java.lang.String s)
s
- the encoded string, with double quotespublic static java.lang.String decode(java.lang.String s)
s
- the encoded string, without double quotespublic java.lang.String readRawValue()
readRawValue
in interface JsopReader
public int getPos()
public int getLastPos()
public void setPos(int pos)
Copyright © 2010 - 2020 Adobe. All Rights Reserved