- java.lang.Object
-
- at.syntaxerror.json5.JSONParser
-
public class JSONParser extends java.lang.ObjectA JSONParser is used to convert a source string into tokens, which then are used to constructJSONObjectsandJSONArrays- Author:
- SyntaxError404
-
-
Constructor Summary
Constructors Constructor Description JSONParser(java.io.InputStream stream)Constructs a new JSONParser from an InputStream.JSONParser(java.io.InputStream stream, JSONOptions options)Constructs a new JSONParser from an InputStream.JSONParser(java.io.Reader reader)Constructs a new JSONParser from a Reader.JSONParser(java.io.Reader reader, JSONOptions options)Constructs a new JSONParser from a Reader.JSONParser(java.lang.String source)Constructs a new JSONParser from a string.JSONParser(java.lang.String source, JSONOptions options)Constructs a new JSONParser from a string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidback()Forces the parser to re-read the last charactercharnextClean()Reads until encountering a character that is not a whitespace according to the JSON5 Specificationjava.lang.StringnextMemberName()Reads a member name from the source according to the JSON5 Specificationjava.lang.ObjectnextValue()Reads a value from the source according to the JSON5 SpecificationJSONExceptionsyntaxError(java.lang.String message)Constructs a new JSONException with a detail messageJSONExceptionsyntaxError(java.lang.String message, java.lang.Throwable cause)Constructs a new JSONException with a detail message and a causing exceptionjava.lang.StringtoString()
-
-
-
Constructor Detail
-
JSONParser
public JSONParser(java.io.Reader reader, JSONOptions options)Constructs a new JSONParser from a Reader. The reader is notclosed- Parameters:
reader- a readeroptions- the options for parsing- Since:
- 1.1.0
-
JSONParser
public JSONParser(java.lang.String source, JSONOptions options)Constructs a new JSONParser from a string- Parameters:
source- a stringoptions- the options for parsing- Since:
- 1.1.0
-
JSONParser
public JSONParser(java.io.InputStream stream, JSONOptions options)Constructs a new JSONParser from an InputStream. The stream is notclosed- Parameters:
stream- a streamoptions- the options for parsing- Since:
- 1.1.0
-
JSONParser
public JSONParser(java.io.Reader reader)
Constructs a new JSONParser from a Reader. The reader is notclosed. This uses thedefault options- Parameters:
reader- a reader
-
JSONParser
public JSONParser(java.lang.String source)
Constructs a new JSONParser from a string. This uses thedefault options- Parameters:
source- a string
-
JSONParser
public JSONParser(java.io.InputStream stream)
Constructs a new JSONParser from an InputStream. The stream is notclosed. This uses thedefault options- Parameters:
stream- a stream
-
-
Method Detail
-
back
public void back()
Forces the parser to re-read the last character
-
nextClean
public char nextClean()
Reads until encountering a character that is not a whitespace according to the JSON5 Specification- Returns:
- a non-whitespace character, or
0if the end of the stream has been reached
-
nextMemberName
public java.lang.String nextMemberName()
Reads a member name from the source according to the JSON5 Specification- Returns:
- an member name
-
nextValue
public java.lang.Object nextValue()
Reads a value from the source according to the JSON5 Specification- Returns:
- an member name
-
syntaxError
public JSONException syntaxError(java.lang.String message, java.lang.Throwable cause)
Constructs a new JSONException with a detail message and a causing exception- Parameters:
message- the detail messagecause- the causing exception- Returns:
- a JSONException
-
syntaxError
public JSONException syntaxError(java.lang.String message)
Constructs a new JSONException with a detail message- Parameters:
message- the detail message- Returns:
- a JSONException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-