ikrs.json.parser
Class JSONParser

java.lang.Object
  extended by ikrs.json.parser.JSONParser
Direct Known Subclasses:
ConfigurableJSONBuilder, JSONBuilder, JSONBuilderExample

public class JSONParser
extends java.lang.Object


Constructor Summary
JSONParser(java.io.Reader reader)
          Creates a new JSONParser (in case-insensitive mode).
JSONParser(java.io.Reader reader, boolean caseSensitive)
          Creates a new JSONParser.
 
Method Summary
protected  void fireArrayBegin()
           
protected  void fireArrayElementEnd()
           
protected  void fireArrayEnd()
           
protected  void fireFalseRead(java.lang.String value)
           
protected  void fireJSONBegin()
           
protected  void fireJSONEnd()
           
protected  void fireMemberBegin()
           
protected  void fireMemberEnd()
           
protected  void fireMemberNameRead(java.lang.String token)
           
protected  void fireNullRead(java.lang.String value)
           
protected  void fireNumberRead(java.lang.String number)
           
protected  void fireObjectBegin()
           
protected  void fireObjectEnd()
           
protected  void fireStringRead(java.lang.String token)
           
protected  void fireTrueRead(java.lang.String value)
           
 int getColumnNumber()
          Get the parser's current column number.
 int getLineNumber()
          Get the parser's current line number.
 int getReadPosition()
          Get the parser's current read position inside the input stream.
static void main(java.lang.String[] argv)
          For testing purposes only.
 boolean parse()
          Start the parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONParser

public JSONParser(java.io.Reader reader)
           throws java.lang.NullPointerException
Creates a new JSONParser (in case-insensitive mode).

Parameters:
reader - The reader to read tokens from.
Throws:
java.lang.NullPointerException - If the passed reader is null.

JSONParser

public JSONParser(java.io.Reader reader,
                  boolean caseSensitive)
           throws java.lang.NullPointerException
Creates a new JSONParser.

Parameters:
reader - The reader to read tokens from.
Throws:
java.lang.NullPointerException - If the passed reader is null.
Method Detail

fireJSONBegin

protected void fireJSONBegin()

fireJSONEnd

protected void fireJSONEnd()

fireArrayBegin

protected void fireArrayBegin()

fireArrayElementEnd

protected void fireArrayElementEnd()

fireArrayEnd

protected void fireArrayEnd()

fireObjectBegin

protected void fireObjectBegin()

fireObjectEnd

protected void fireObjectEnd()

fireMemberBegin

protected void fireMemberBegin()

fireMemberNameRead

protected void fireMemberNameRead(java.lang.String token)

fireMemberEnd

protected void fireMemberEnd()

fireNumberRead

protected void fireNumberRead(java.lang.String number)

fireStringRead

protected void fireStringRead(java.lang.String token)

fireTrueRead

protected void fireTrueRead(java.lang.String value)

fireFalseRead

protected void fireFalseRead(java.lang.String value)

fireNullRead

protected void fireNullRead(java.lang.String value)

getReadPosition

public int getReadPosition()
Get the parser's current read position inside the input stream.

Returns:
The byte offset inside the stream.

getLineNumber

public int getLineNumber()
Get the parser's current line number. The initial line number is 0.

Returns:
The parser's current line number.

getColumnNumber

public int getColumnNumber()
Get the parser's current column number. The initial column number is 0.

Returns:
The parser's current column number.

parse

public boolean parse()
              throws java.io.IOException,
                     JSONSyntaxException
Start the parser.

Returns:
True if and only if the next JSON value was successfully read from the underlying stream without reaching EOI before completion.
Throws:
java.io.IOException - If any IO errors occur.
JSONException - If the JSON code is not valid. The thrown exception contains the error offset and line- and column number.
JSONSyntaxException

main

public static void main(java.lang.String[] argv)
For testing purposes only.