public interface JSONContentHandler
A simplified and stoppable SAX-like content handler for stream processing of JSON text.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- FangYidong(fangyidong@yahoo.com.cn)
- See Also:
-
org.xml.sax.ContentHandler
JSONParser.parse(java.io.Reader, JSONContentHandler, boolean)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
endArray()
Receives a notification when a JSON array ends.void
endJSON()
Receives a notification when the JSON processing ends.boolean
Receives a notification when a JSON object ends.boolean
Receives a notification when a JSON entry ends.boolean
boolean
Receives a notification when a JSON array begins.void
Receives a notification when the JSON processing begins.boolean
Receives a notification when a JSON object begins.boolean
startObjectEntry
(String key) Receives a notification when a JSON object entry begins.
-
Method Details
-
startJSON
Receives a notification when the JSON processing begins. The JSONParser will invoke this method only once.- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
-
endJSON
Receives a notification when the JSON processing ends.- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
-
startObject
Receives a notification when a JSON object begins.- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
- See Also:
-
endObject
Receives a notification when a JSON object ends.- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
- See Also:
-
startObjectEntry
Receives a notification when a JSON object entry begins.- Parameters:
key
- name of the object entry- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
- See Also:
-
endObjectEntry
Receives a notification when a JSON entry ends.- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- See Also:
-
startArray
Receives a notification when a JSON array begins.- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
- See Also:
-
endArray
Receives a notification when a JSON array ends.- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
- See Also:
-
primitive
- Parameters:
value
- the primitive JSON value- Returns:
false
if the JSONContentHandler wants to stop parsing after return- Throws:
JSONParseException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.IOException
- JSONParser will stop and throw the same Exception to the caller when receiving this Exception.- Since:
- 1.0.0
-