Package org.apache.groovy.json.internal

# Class JsonParserCharArray

java.lang.Object
org.apache.groovy.json.internal.BaseJsonParser
org.apache.groovy.json.internal.JsonParserCharArray

All Implemented Interfaces:
  `JsonParser`

Direct Known Subclasses:
  `JsonFastParser`, `JsonParserLax`

public class JsonParserCharArray extends BaseJsonParser
Converts an input JSON String into Java objects works with String or char array as input. Produces an Object which can be any of the basic JSON types mapped to Java.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected char`
  `__currentChar`
  Character at the current parser position.
  `protected int`
  `__index`
  Current position within `charArray`.
  `protected char[]`
  `charArray`
  Character buffer currently being parsed.
  `protected static char[]`
  `FALSE`
  Character buffer for the `false` literal.
  `protected static final char[]`
  `NULL`
  Character buffer for the `null` literal.
  `protected static final char[]`
  `TRUE`
  Character buffer for the `true` literal.

  ### Fields inherited from class org.apache.groovy.json.internal.BaseJsonParser

  `ALPHA_0, ALPHA_1, ALPHA_2, ALPHA_3, ALPHA_4, ALPHA_5, ALPHA_6, ALPHA_7, ALPHA_8, ALPHA_9, bufSize, charset, CLOSED_BRACKET, CLOSED_CURLY, COLON, COMMA, DECIMAL_POINT, DEFAULT_MAX_NESTING_DEPTH, DOUBLE_QUOTE, ESCAPE, internedKeysCache, internKeys, LETTER_BIG_E, LETTER_E, maxNestingDepth, MINUS, PLUS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JsonParserCharArray()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected final void`
  `complain(String complaint)`
  Throws a `JsonException` for the current location.
  `protected final char`
  `currentChar()`
  Returns the current character in the input buffer.
  `protected final boolean`
  `decodeFalse()`
  Consumes the `false` literal.
  `protected Object`
  `decodeFromChars(char[] cs)`
  Initializes parser state and decodes a character buffer.
  `protected final List`
  `decodeJsonArray()`
  Decodes a JSON array from the current position.
  `protected final Object`
  `decodeJsonObject()`
  Decodes a JSON object from the current position.
  `protected final Object`
  `decodeNull()`
  Consumes the `null` literal.
  `protected final boolean`
  `decodeTrue()`
  Consumes the `true` literal.
  `protected Object`
  `decodeValue()`
  Decodes the next JSON value.
  `protected String`
  `exceptionDetails(String message)`
  Builds an error message using the current parser position.
  `protected final boolean`
  `hasCurrent()`
  Checks whether the current index is still within the buffer.
  `protected final boolean`
  `hasMore()`
  Checks whether more characters remain after the current index.
  `protected final char`
  `nextChar()`
  Advances to the next character in the input buffer.
  `Object`
  `parse(char[] chars)`
  Parses JSON from a character array.
  `protected final void`
  `skipWhiteSpace()`
  Advances past JSON whitespace characters.

  ### Methods inherited from class org.apache.groovy.json.internal.BaseJsonParser

  `charDescription, enterNesting, exitNesting, findEndQuote, getMaxNestingDepth, hasEscapeChar, isDecimalChar, isDelimiter, isDoubleQuote, isEscape, isNumberDigit, parse, parse, parse, parse, parse, parse, parse, parse, resetNesting, setCharset, setMaxNestingDepth`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### charArray

    protected char[] charArray
    Character buffer currently being parsed.

  - ### __index

    protected int __index
    Current position within `charArray`.

  - ### __currentChar

    protected char __currentChar
    Character at the current parser position.

  - ### NULL

    protected static final char[] NULL
    Character buffer for the `null` literal.

  - ### TRUE

    protected static final char[] TRUE
    Character buffer for the `true` literal.

  - ### FALSE

    protected static char[] FALSE
    Character buffer for the `false` literal.

- ## Constructor Details

  - ### JsonParserCharArray

    public JsonParserCharArray()

- ## Method Details

  - ### decodeFromChars

    protected Object decodeFromChars(char[] cs)
    Initializes parser state and decodes a character buffer.
    Parameters:
      `cs` - JSON content to parse
    Returns:
      parsed Groovy JSON value

  - ### hasMore

    protected final boolean hasMore()
    Checks whether more characters remain after the current index.
    Returns:
      `true` when another character can be consumed

  - ### hasCurrent

    protected final boolean hasCurrent()
    Checks whether the current index is still within the buffer.
    Returns:
      `true` when the current position is valid

  - ### skipWhiteSpace

    protected final void skipWhiteSpace()
    Advances past JSON whitespace characters.

  - ### nextChar

    protected final char nextChar()
    Advances to the next character in the input buffer.
    Returns:
      next character, or `0` when the buffer is exhausted

  - ### exceptionDetails

    protected String exceptionDetails(String message)
    Builds an error message using the current parser position.
    Parameters:
      `message` - parser-specific message
    Returns:
      formatted error details

  - ### decodeJsonObject

    protected final Object decodeJsonObject()
    Decodes a JSON object from the current position.
    Returns:
      parsed object as a `LazyMap`

  - ### complain

    protected final void complain(String complaint)
    Throws a `JsonException` for the current location.
    Parameters:
      `complaint` - message describing the parse failure

  - ### decodeValue

    protected Object decodeValue()
    Decodes the next JSON value.
    Returns:
      parsed Groovy JSON value

  - ### decodeNull

    protected final Object decodeNull()
    Consumes the `null` literal.
    Returns:
      `null`

  - ### decodeTrue

    protected final boolean decodeTrue()
    Consumes the `true` literal.
    Returns:
      `true`

  - ### decodeFalse

    protected final boolean decodeFalse()
    Consumes the `false` literal.
    Returns:
      `false`

  - ### decodeJsonArray

    protected final List decodeJsonArray()
    Decodes a JSON array from the current position.
    Returns:
      parsed array contents

  - ### currentChar

    protected final char currentChar()
    Returns the current character in the input buffer.
    Returns:
      current character, or `0` when the index is past the end

  - ### parse

    public Object parse(char[] chars)
    Parses JSON from a character array.
    Parameters:
      `chars` - JSON content to parse
    Returns:
      parsed Groovy JSON value