public class JSONTokener extends Object
| 构造器和说明 |
|---|
JSONTokener(InputStream inputStream)
从InputStream中构建
|
JSONTokener(Reader reader)
从Reader中构建
|
JSONTokener(String s)
从字符串中构建
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
back()
将标记回退到第一个字符,重新开始解析新的JSON
|
static int |
dehexchar(char c)
Get the hex value of a character (base16).
|
boolean |
end() |
boolean |
more()
源字符串是否有更多的字符
|
char |
next()
获得源字符串中的下一个字符
|
char |
next(char c)
读取下一个字符,并比对是否和指定字符匹配
|
String |
next(int n)
获得接下来的n个字符
|
char |
nextClean()
获得下一个字符,跳过空白符
|
String |
nextString(char quote)
返回当前位置到指定引号前的所有字符,反斜杠的转义符也会被处理。
|
String |
nextTo(char delimiter)
Get the text up but not including the specified character or the end of line, whichever comes first.
|
String |
nextTo(String delimiters)
Get the text up but not including one of the specified delimiter characters or the end of line, whichever comes first.
|
Object |
nextValue()
获得下一个值,值类型可以是Boolean, Double, Integer, JSONArray, JSONObject, Long, or String, or the JSONObject.NULL
|
char |
skipTo(char to)
Skip characters until the next character is the requested character.
|
JSONException |
syntaxError(String message)
Make a JSONException to signal a syntax error.
|
JSONArray |
toJSONArray()
转为
JSONArray |
String |
toString()
Make a printable string of this JSONTokener.
|
public JSONTokener(Reader reader)
reader - Readerpublic JSONTokener(InputStream inputStream) throws JSONException
inputStream - InputStreamJSONExceptionpublic JSONTokener(String s)
s - JSON字符串public void back()
throws JSONException
JSONExceptionpublic static int dehexchar(char c)
c - A character between '0' and '9' or between 'A' and 'F' or between 'a' and 'f'.public boolean end()
public boolean more()
throws JSONException
JSONExceptionpublic char next()
throws JSONException
JSONExceptionpublic char next(char c)
throws JSONException
c - 被匹配的字符JSONException - 如果不匹配抛出此异常public String next(int n) throws JSONException
n - 字符数JSONException - 如果源中余下的字符数不足以提供所需的字符数,抛出此异常public char nextClean()
throws JSONException
JSONException - 获得下一个字符时抛出的异常public String nextString(char quote) throws JSONException
quote - 字符引号, 包括 "(双引号) 或 '(单引号)。JSONException - 出现无结束的字符串时抛出此异常public String nextTo(char delimiter) throws JSONException
delimiter - 分隔符JSONExceptionpublic String nextTo(String delimiters) throws JSONException
delimiters - A set of delimiter characters.JSONExceptionpublic Object nextValue() throws JSONException
JSONException - 语法错误public char skipTo(char to)
throws JSONException
to - A character to skip to.JSONExceptionpublic JSONException syntaxError(String message)
message - 错误消息Copyright © 2017. All rights reserved.