org.xerial.json
Class JSONPullParser

java.lang.Object
  extended by org.xerial.json.JSONPullParser

public class JSONPullParser
extends Object

Pull Parser for JSON data

Author:
leo

Constructor Summary
  JSONPullParser(InputStream jsonStream)
           
protected JSONPullParser(JSONLexer lexer)
           
  JSONPullParser(JSONObject jsonObject)
           
  JSONPullParser(Reader reader)
           
  JSONPullParser(String jsonString)
           
 
Method Summary
 int getDepth()
           
 String getKeyName()
          Gets the current object/array/value key.
 String getText()
           
 JSONValue getValue()
          Reads the current JSONValue, which is one of JSONObject , JSONArray, JSONInteger, JSONDouble, JSONString, JSONBoolean and JSONNull.
 JSONEvent next()
          Reads the next JSONEvent
protected  JSONEvent reportEvent(org.antlr.runtime.Token token, JSONEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONPullParser

public JSONPullParser(String jsonString)

JSONPullParser

public JSONPullParser(JSONObject jsonObject)

JSONPullParser

public JSONPullParser(InputStream jsonStream)
               throws IOException
Throws:
IOException

JSONPullParser

public JSONPullParser(Reader reader)
               throws IOException
Throws:
IOException

JSONPullParser

protected JSONPullParser(JSONLexer lexer)
Method Detail

getValue

public JSONValue getValue()
                   throws JSONException
Reads the current JSONValue, which is one of JSONObject , JSONArray, JSONInteger, JSONDouble, JSONString, JSONBoolean and JSONNull. This methods proceeds the parse state up to the end of the returned value.

Returns:
the current JSONValue
Throws:
JSONException - when the current token is not a JSONValue

next

public JSONEvent next()
               throws JSONException
Reads the next JSONEvent

Returns:
the next JSONEvent. If no more token is available, returns JSONEvent.EndJSON.
Throws:
JSONException - when some syntax error is found.

reportEvent

protected JSONEvent reportEvent(org.antlr.runtime.Token token,
                                JSONEvent e)

getKeyName

public String getKeyName()
                  throws JSONException
Gets the current object/array/value key.

Returns:
the current key, or null when the current token is no name array or object.
Throws:
JSONException

getText

public String getText()

getDepth

public int getDepth()


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.