public class JSONTokener
extends java.lang.Object
| Constructor and Description |
|---|
JSONTokener(java.io.Reader reader)
Construct a JSONTokener from a string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
back()
Back up one character.
|
static int |
dehexchar(char c)
Get the hex value of a character (base16).
|
boolean |
endArray() |
boolean |
endObject() |
boolean |
more()
Determine if the source string still contains characters that next()
can consume.
|
char |
next()
Get the next character in the source string.
|
char |
next(char c)
Consume the next character, and check that it matches a specified
character.
|
java.lang.String |
next(int n)
Get the next n characters.
|
char |
nextClean()
Get the next char in the string, skipping whitespace.
|
java.lang.String |
nextKey() |
boolean |
nextNull() |
java.lang.String |
nextSimple() |
java.lang.String |
nextString()
Return the characters up to the next close quote character.
|
java.lang.String |
nextTo(char d)
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.
|
char |
skipTo(char to)
Skip characters until the next character is the requested character.
|
void |
startArray() |
void |
startObject() |
java.io.IOException |
syntaxError(java.lang.String message)
Make a JSONException to signal a syntax error.
|
java.lang.String |
toString()
Make a printable string of this JSONTokener.
|
public JSONTokener(java.io.Reader reader)
reader - A reader.public void back()
throws java.io.IOException
java.io.IOExceptionpublic static int dehexchar(char c)
c - A character between '0' and '9' or between 'A' and 'F' or
between 'a' and 'f'.public void startArray()
throws java.io.IOException
java.io.IOExceptionpublic boolean endArray()
throws java.io.IOException
java.io.IOExceptionpublic boolean more()
throws java.io.IOException
java.io.IOExceptionpublic char next()
throws java.io.IOException
java.io.IOExceptionpublic char next(char c)
throws java.io.IOException
c - The character to match.JSONException - if the character does not match.java.io.IOExceptionpublic java.lang.String next(int n)
throws java.io.IOException
n - The number of characters to take.JSONException - Substring bounds error if there are not
n characters remaining in the source string.java.io.IOExceptionpublic char nextClean()
throws java.io.IOException
JSONExceptionjava.io.IOExceptionpublic void startObject()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String nextKey()
throws java.io.IOException
java.io.IOExceptionpublic boolean nextNull()
throws java.io.IOException
java.io.IOExceptionpublic boolean endObject()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String nextSimple()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String nextString()
throws java.io.IOException
quote - The quoting character, either
" (double quote) or
' (single quote).JSONException - Unterminated string.java.io.IOExceptionpublic java.lang.String nextTo(char d)
throws java.io.IOException
d - A delimiter character.java.io.IOExceptionpublic java.lang.String nextTo(java.lang.String delimiters)
throws java.io.IOException
delimiters - A set of delimiter characters.java.io.IOExceptionpublic char skipTo(char to)
throws java.io.IOException
to - A character to skip to.java.io.IOExceptionpublic java.io.IOException syntaxError(java.lang.String message)
message - The error message.public java.lang.String toString()
toString in class java.lang.Object