java.lang.Object
de.ralleytn.simple.json.JSONParser
Parses JSON data (not thread-safe).
- Since:
- 1.0.0
- Version:
- 2.1.0
- Author:
- FangYidong(fangyidong@yahoo.com.cn), Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Parses JSON data from a Reader.Parses JSON data from a Reader.void
parse
(Reader reader, JSONContentHandler contentHandler) Goes over JSON data step by step using a JSONContentHandler.void
parse
(Reader reader, JSONContentHandler contentHandler, boolean resume) Goes over JSON data step by step using a JSONContentHandler.void
parse
(Reader reader, JSONContentHandler contentHandler, boolean resume, boolean strict) Goes over JSON data step by step using a JSONContentHandler.Parses JSON data.Parses JSON data.void
parse
(String string, JSONContentHandler contentHandler) Goes over a JSON string step by step using a JSONContentHandler.void
parse
(String string, JSONContentHandler contentHandler, boolean resume) Goes over a JSON string step by step using a JSONContentHandler.void
reset()
Resets the parser to the initial state without resetting the underlying reader.void
Resets the parser to the initial state with a new character reader.
-
Constructor Details
-
JSONParser
public JSONParser()
-
-
Method Details
-
reset
public void reset()Resets the parser to the initial state without resetting the underlying reader.- Since:
- 1.0.0
-
reset
Resets the parser to the initial state with a new character reader.- Parameters:
reader
- the new character reader- Since:
- 1.0.0
-
getPosition
public int getPosition()- Returns:
- the position where the current token begins
- Since:
- 1.0.0
-
parse
Parses JSON data.- Parameters:
json
- the JSON data- Returns:
- An instance of:
- Throws:
JSONParseException
- if the JSON is invalid- Since:
- 1.0.0
-
parse
Parses JSON data.- Parameters:
json
- the JSON datastrict
-true
for strict validation of JSON data;false
if missing colons and commas should be tolerated- Returns:
- An instance of:
- Throws:
JSONParseException
- if the JSON is invalid- Since:
- 2.1.0
-
parse
Parses JSON data from a Reader.- Parameters:
reader
- the Reader- Returns:
- An instance of:
- Throws:
IOException
- if an I/O error occursJSONParseException
- if the JSON is invalid- Since:
- 1.0.0
-
parse
Parses JSON data from a Reader.- Parameters:
reader
- the Readerstrict
-true
for strict validation of JSON data;false
if missing colons and commas should be tolerated- Returns:
- An instance of:
- Throws:
IOException
- if an I/O error occursJSONParseException
- if the JSON is invalid- Since:
- 2.1.0
-
parse
Goes over a JSON string step by step using a JSONContentHandler.- Parameters:
string
- the JSON stringcontentHandler
- the JSONContentHandler- Throws:
JSONParseException
- if the JSON is invalid or the JSONContentHandler throws it- Since:
- 1.0.0
-
parse
public void parse(String string, JSONContentHandler contentHandler, boolean resume) throws JSONParseException Goes over a JSON string step by step using a JSONContentHandler.- Parameters:
string
- the JSON stringcontentHandler
- the JSONContentHandlerresume
- Indicates if the previous parsing operation should be continued.- Throws:
JSONParseException
- if the JSON is invalid or the JSONContentHandler throws it- Since:
- 1.0.0
-
parse
public void parse(Reader reader, JSONContentHandler contentHandler) throws IOException, JSONParseException Goes over JSON data step by step using a JSONContentHandler.- Parameters:
reader
- the ReadercontentHandler
- the JSONContentHandler- Throws:
IOException
- if an I/O error occurs or the JSONContentHandler throws itJSONParseException
- if the JSON is invalid or the JSONContentHandler throws it- Since:
- 1.0.0
-
parse
public void parse(Reader reader, JSONContentHandler contentHandler, boolean resume) throws IOException, JSONParseException Goes over JSON data step by step using a JSONContentHandler.- Parameters:
reader
- the ReadercontentHandler
- the JSONContentHandlerresume
- Indicates if the previous parsing operation should be continued.- Throws:
IOException
- if an I/O error occurs or the JSONContentHandler throws itJSONParseException
- if the JSON is invalid or the JSONContentHandler throws it- Since:
- 1.0.0
- See Also:
-
parse
public void parse(Reader reader, JSONContentHandler contentHandler, boolean resume, boolean strict) throws IOException, JSONParseException Goes over JSON data step by step using a JSONContentHandler.- Parameters:
reader
- the ReadercontentHandler
- the JSONContentHandlerresume
- Indicates if the previous parsing operation should be continued.strict
-true
for strict validation of JSON data;false
if missing colons and commas should be tolerated- Throws:
IOException
- if an I/O error occurs or the JSONContentHandler throws itJSONParseException
- if the JSON is invalid or the JSONContentHandler throws it- Since:
- 2.1.0
- See Also:
-