Class JSONParser


  • public class JSONParser
    extends java.lang.Object
    Parser for JSON text. Please note that JSONParser is NOT thread-safe.
    Author:
    FangYidong<fangyidong@yahoo.com.cn>
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getPosition()  
      java.lang.Object parse​(java.io.Reader in)  
      java.lang.Object parse​(java.io.Reader in, ContainerFactory containerFactory)
      Parse JSON text into java object from the input source.
      java.lang.Object parse​(java.lang.String s)  
      java.lang.Object parse​(java.lang.String s, ContainerFactory containerFactory)  
      void reset()
      Reset the parser to the initial state without resetting the underlying reader.
      void reset​(java.io.Reader in)
      Reset the parser to the initial state with a new character reader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSONParser

        public JSONParser()
    • Method Detail

      • reset

        public void reset()
        Reset the parser to the initial state without resetting the underlying reader.
      • reset

        public void reset​(java.io.Reader in)
        Reset the parser to the initial state with a new character reader.
        Parameters:
        in - - The new character reader.
        Throws:
        java.io.IOException
        ParseException
      • getPosition

        public int getPosition()
        Returns:
        The position of the beginning of the current token.
      • parse

        public java.lang.Object parse​(java.io.Reader in)
                               throws java.io.IOException,
                                      ParseException
        Throws:
        java.io.IOException
        ParseException
      • parse

        public java.lang.Object parse​(java.io.Reader in,
                                      ContainerFactory containerFactory)
                               throws java.io.IOException,
                                      ParseException
        Parse JSON text into java object from the input source.
        Parameters:
        in -
        containerFactory - - Use this factory to create your own JSON object and JSON array containers.
        Returns:
        Instance of the following: org.zkoss.json.JSONObject, org.zkoss.json.JSONArray, java.lang.String, java.lang.Number, java.lang.Boolean, null
        Throws:
        java.io.IOException
        ParseException