getPrevious
protected char getPrevious()
Get the last character read from the input or '\0' if nothing has been read yet.
the last character read from the input.
public String nextString(char quote)
throws JSONException
返回当前位置到指定引号前的所有字符,反斜杠的转义符也会被处理。
标准的JSON是不允许使用单引号包含字符串的,但是此实现允许。
quote
- 字符引号, 包括
"
(双引号) 或
'
(单引号)。
截止到引号前的字符串
JSONException
- 出现无结束的字符串时抛出此异常
public String nextTo(char delimiter)
throws JSONException
Get the text up but not including the specified character or the end of line, whichever comes first.
获得从当前位置直到分隔符(不包括分隔符)或行尾的的所有字符。
delimiter
- 分隔符
JSONException
public String nextTo(String delimiters)
throws JSONException
Get the text up but not including one of the specified delimiter characters or the end of line, whichever comes first.
delimiters
- A set of delimiter characters.
A string, trimmed.
JSONException
public Object nextValue()
throws JSONException
获得下一个值,值类型可以是Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the JSONObject.NULL
Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the JSONObject.NULL
JSONException
- 语法错误
public char skipTo(char to)
throws JSONException
Skip characters until the next character is the requested character. If the requested character is not found, no characters are skipped. 在遇到指定字符前,跳过其它字符。如果字符未找到,则不跳过任何字符。
to
- 需要定位的字符
定位的字符,如果字符未找到返回0
JSONException
syntaxError
public JSONException syntaxError(String message)
Make a JSONException to signal a syntax error.
构建 JSONException 用于表示语法错误
message
- 错误消息
A JSONException object, suitable for throwing