## org.apache.noggit
Class JSONParser

    java.lang.Object
      org.apache.noggit.JSONParser

    public class JSONParser

extends Object

Nested Class Summary
`static class` `JSONParser.ParseException`

Field Summary
`static int` `ARRAY_END` Event indicating the end of a JSON array
`static int` `ARRAY_START` Event indicating the start of a JSON array
`static int` `BIGNUMBER` Event indicating a JSON number value that was not produced by toString of any Java primitive numerics such as Double or Long.
`static int` `BOOLEAN` Event indicating a JSON boolean
`static int` `EOF` Event indicating the end of input has been reached
`static int` `LONG` Event indicating a JSON number value which fits into a signed 64 bit integer
`static int` `NULL` Event indicating a JSON null
`static int` `NUMBER` Event indicating a JSON number value which has a fractional part or an exponent and with string length <= 23 chars not including sign.
`static int` `OBJECT_END` Event indicating the end of a JSON object
`static int` `OBJECT_START` Event indicating the start of a JSON object
`static int` `STRING` Event indicating a JSON string value, including member names of objects

Constructor Summary
`JSONParser(char[] data, int start, int end)`
`JSONParser(Reader in)`
`JSONParser(Reader in, char[] buffer)`
`JSONParser(String data)`
`JSONParser(String data, int start, int end)`

Method Summary
`protected void` `fill()`
`boolean` `getBoolean()` Reads a boolean value
`protected int` `getChar()`
`double` `getDouble()` Reads a number from the input stream and parses it as a double
`static String` `getEventString(int e)`
`int` `getLevel()`
`long` `getLong()` Reads a number from the input stream and parses it as a long, only if the value will in fact fit into a signed 64 bit integer.
`void` `getNull()` Reads a null value
`CharArr` `getNumberChars()` Returns the characters of a JSON numeric value.
`void` `getNumberChars(CharArr output)` Reads a JSON numeric value into the output.
`long` `getPosition()`
`String` `getString()` Returns the JSON string value, decoding any escaped characters.
`void` `getString(CharArr output)` Reads a JSON string into the output, decoding any escaped characters.
`CharArr` `getStringChars()` Returns the characters of a JSON string value, decoding any escaped characters.
`int` `lastEvent()`
`int` `nextEvent()` Returns the next event encountered in the JSON stream, one of `STRING` `LONG` `NUMBER` `BIGNUMBER` `BOOLEAN` `NULL` `OBJECT_START` `OBJECT_END` `OBJECT_END` `ARRAY_START` `ARRAY_END` `EOF`
`String` `toString()`
`boolean` `wasKey()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### STRING

    public static final int STRING

  Event indicating a JSON string value, including member names of objects

  See Also:
    Constant Field Values

### LONG

    public static final int LONG

  Event indicating a JSON number value which fits into a signed 64 bit integer

  See Also:
    Constant Field Values

### NUMBER

    public static final int NUMBER

  Event indicating a JSON number value which has a fractional part or an exponent and with string length <= 23 chars not including sign. This covers all representations of normal values for Double.toString().

  See Also:
    Constant Field Values

### BIGNUMBER

    public static final int BIGNUMBER

  Event indicating a JSON number value that was not produced by toString of any Java primitive numerics such as Double or Long. It is either an integer outside the range of a 64 bit signed integer, or a floating point value with a string representation of more than 23 chars.

  See Also:
    Constant Field Values

### BOOLEAN

    public static final int BOOLEAN

  Event indicating a JSON boolean

  See Also:
    Constant Field Values

### NULL

    public static final int NULL

  Event indicating a JSON null

  See Also:
    Constant Field Values

### OBJECT_START

    public static final int OBJECT_START

  Event indicating the start of a JSON object

  See Also:
    Constant Field Values

### OBJECT_END

    public static final int OBJECT_END

  Event indicating the end of a JSON object

  See Also:
    Constant Field Values

### ARRAY_START

    public static final int ARRAY_START

  Event indicating the start of a JSON array

  See Also:
    Constant Field Values

### ARRAY_END

    public static final int ARRAY_END

  Event indicating the end of a JSON array

  See Also:
    Constant Field Values

### EOF

    public static final int EOF

  Event indicating the end of input has been reached

  See Also:
    Constant Field Values

Constructor Detail

### JSONParser

    public JSONParser(Reader in)

### JSONParser

    public JSONParser(Reader in,
                      char[] buffer)

### JSONParser

    public JSONParser(char[] data,
                      int start,
                      int end)

### JSONParser

    public JSONParser(String data)

### JSONParser

    public JSONParser(String data,
                      int start,
                      int end)

Method Detail

### getEventString

    public static String getEventString(int e)

### fill

    protected void fill()
                 throws IOException

  Throws:
    `IOException`

### getChar

    protected int getChar()
                   throws IOException

  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### nextEvent

    public int nextEvent()
                  throws IOException

  Returns the next event encountered in the JSON stream, one of
  - `STRING`
  - `LONG`
  - `NUMBER`
  - `BIGNUMBER`
  - `BOOLEAN`
  - `NULL`
  - `OBJECT_START`
  - `OBJECT_END`
  - `OBJECT_END`
  - `ARRAY_START`
  - `ARRAY_END`
  - `EOF`

  Throws:
    `IOException`

### lastEvent

    public int lastEvent()

### wasKey

    public boolean wasKey()

### getString

    public String getString()
                     throws IOException

  Returns the JSON string value, decoding any escaped characters.

  Throws:
    `IOException`

### getStringChars

    public CharArr getStringChars()
                           throws IOException

  Returns the characters of a JSON string value, decoding any escaped characters.

  The underlying buffer of the returned `CharArr` should *not* be modified as it may be shared with the input buffer.

  The returned `CharArr` will only be valid up until the next JSONParser method is called. Any required data should be read before that point.

  Throws:
    `IOException`

### getString

    public void getString(CharArr output)
                   throws IOException

  Reads a JSON string into the output, decoding any escaped characters.

  Throws:
    `IOException`

### getLong

    public long getLong()
                 throws IOException

  Reads a number from the input stream and parses it as a long, only if the value will in fact fit into a signed 64 bit integer.

  Throws:
    `IOException`

### getDouble

    public double getDouble()
                     throws IOException

  Reads a number from the input stream and parses it as a double

  Throws:
    `IOException`

### getNumberChars

    public CharArr getNumberChars()
                           throws IOException

  Returns the characters of a JSON numeric value.

  The underlying buffer of the returned `CharArr` should *not* be modified as it may be shared with the input buffer.

  The returned `CharArr` will only be valid up until the next JSONParser method is called. Any required data should be read before that point.

  Throws:
    `IOException`

### getNumberChars

    public void getNumberChars(CharArr output)
                        throws IOException

  Reads a JSON numeric value into the output.

  Throws:
    `IOException`

### getBoolean

    public boolean getBoolean()
                       throws IOException

  Reads a boolean value

  Throws:
    `IOException`

### getNull

    public void getNull()
                 throws IOException

  Reads a null value

  Throws:
    `IOException`

### getLevel

    public int getLevel()

  Returns:
    the current nesting level, the number of parent objects or arrays.

### getPosition

    public long getPosition()