public interface JsonHandler
Modifier and Type | Method and Description |
---|---|
void |
bool(boolean bool)
Reports a boolean.
|
void |
characters(char[] ch,
int start,
int length)
Adds characters to the current string started with
startString() . |
void |
endArray()
Reports the end of an array.
|
void |
endDocument()
Reports the end of the JSON file.
|
void |
endObject()
Reports the end of an object.
|
void |
endString()
Reports the end of a string.
|
void |
key(java.lang.String key)
Starts a key-value pair inside an object.
|
void |
number(double number)
Reports a number.
|
void |
number(float number)
Reports a number.
|
void |
number(int number)
Reports a number.
|
void |
number(long number)
Reports a number.
|
void |
startArray()
Reports the start of an array.
|
void |
startDocument(java.lang.String callback)
Reports the start of the JSON file.
|
void |
startObject()
Reports the start of an object.
|
void |
startString()
Reports the start of a string.
|
void |
string(java.lang.String string)
Reports a JSON null on
null and
a string otherwise. |
void startDocument(java.lang.String callback) throws org.xml.sax.SAXException
callback
is
null
, the file is a pure JSON file. With a non-null
callback
, a JSON value is wrapped in a function call named
callback.
Note that the JSON null value is represented as
string(null)
.
callback
- JavaScript callback function name or null
for
pure JSON.org.xml.sax.SAXException
- if bad things happenvoid endDocument() throws org.xml.sax.SAXException
finally
.org.xml.sax.SAXException
- if bad things happenvoid startArray() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid endArray() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid startObject() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid key(java.lang.String key) throws org.xml.sax.SAXException
key
gives the key and the next
reported value is taken to be the value associated with
the key. (Hence, there is no need for a corresponding
end
callback.)key
- the key for the key-value pair (must not be null
)org.xml.sax.SAXException
- if bad things happenvoid endObject() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid startString() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
startString()
.ch
- a buffer of UTF-16 code unitsstart
- the first code unit to readlength
- the number of code units to readorg.xml.sax.SAXException
- if bad things happenvoid endString() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- if bad things happenvoid string(java.lang.String string) throws org.xml.sax.SAXException
null
and
a string otherwise.
When the argument is not null
, this method is
shorthand for
startString(); characters(string.toCharArray(), 0, string.length()); endString();
string
- a string or null
org.xml.sax.SAXException
- if bad things happenvoid number(int number) throws org.xml.sax.SAXException
number
- the numberorg.xml.sax.SAXException
- if bad things happenvoid number(long number) throws org.xml.sax.SAXException
number
- the numberorg.xml.sax.SAXException
- if bad things happenvoid number(float number) throws org.xml.sax.SAXException
number
- the numberorg.xml.sax.SAXException
- if bad things happenvoid number(double number) throws org.xml.sax.SAXException
number
- the numberorg.xml.sax.SAXException
- if bad things happenvoid bool(boolean bool) throws org.xml.sax.SAXException
bool
- the booleanorg.xml.sax.SAXException
- if bad things happen