Class JSONParser

  • All Implemented Interfaces:
    JSONParserConstants

    public class JSONParser
    extends java.lang.Object
    implements JSONParserConstants
    Basic JSON parser generated by JavaCC. It consumes the input provided through the constructor when parseObject(), parseList(), or parse() are called, and there is no way to directly reset the state.
    • Constructor Detail

      • JSONParser

        public JSONParser​(java.lang.String input)
      • JSONParser

        public JSONParser​(java.io.InputStream stream)
        Constructor with InputStream.
      • JSONParser

        public JSONParser​(java.io.InputStream stream,
                          java.lang.String encoding)
        Constructor with InputStream and supplied encoding
      • JSONParser

        public JSONParser​(java.io.Reader stream)
        Constructor.
    • Method Detail

      • parseObject

        public java.util.LinkedHashMap<java.lang.String,​java.lang.Object> parseObject()
                                                                                     throws ParseException
        Parses a JSON object into a Java Map.
        Throws:
        ParseException
      • parseArray

        public java.util.ArrayList<java.lang.Object> parseArray()
                                                         throws ParseException
        Parses a JSON array into a Java List.
        Throws:
        ParseException
      • parse

        public java.lang.Object parse()
                               throws ParseException
        Parses any JSON-parseable object, returning the value.
        Throws:
        ParseException
      • setNativeNumbers

        public void setNativeNumbers​(boolean value)
      • getNativeNumbers

        public boolean getNativeNumbers()
      • ReInit

        public void ReInit​(java.io.InputStream stream)
        Reinitialise.
      • ReInit

        public void ReInit​(java.io.InputStream stream,
                           java.lang.String encoding)
        Reinitialise.
      • ReInit

        public void ReInit​(java.io.Reader stream)
        Reinitialise.
      • getNextToken

        public final Token getNextToken()
        Get the next Token.
      • getToken

        public final Token getToken​(int index)
        Get the specific Token.
      • generateParseException

        public ParseException generateParseException()
        Generate ParseException.
      • trace_enabled

        public final boolean trace_enabled()
        Trace enabled.
      • enable_tracing

        public final void enable_tracing()
        Enable tracing.
      • disable_tracing

        public final void disable_tracing()
        Disable tracing.