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