Package org.apache.groovy.json.internal

# Class ReaderCharacterSource

java.lang.Object
org.apache.groovy.json.internal.ReaderCharacterSource

All Implemented Interfaces:
  `CharacterSource`

public class ReaderCharacterSource extends Object implements CharacterSource

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReaderCharacterSource(Reader reader)`
  `ReaderCharacterSource(Reader reader, int readAheadSize)`
  `ReaderCharacterSource(String string)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `consumeIfMatch(char[] match)`
  Useful for finding constants in a string like true, false, etc.
  `final int`
  `currentChar()`
  returns the current character without changing the IO pointer or index.
  `String`
  `errorDetails(String message)`
  `char[]`
  `findNextChar(int match, int esc)`
  Used to find strings and their ilk Finds the next non-escaped char
  `boolean`
  `hadEscape()`
  `final boolean`
  `hasChar()`
  Checks to see if there is a next character.
  `final int`
  `location()`
  This is mostly for debugging and testing.
  `final int`
  `nextChar()`
  returns the next character moving the file pointer or index to the next location.
  `char[]`
  `readNumber()`
  Reads a number from the character source.
  `final int`
  `safeNextChar()`
  Combines the operations of nextChar and hasChar.
  `void`
  `skipWhiteSpace()`
  Skip white space.

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

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

- ## Constructor Details

  - ### ReaderCharacterSource

    public ReaderCharacterSource(Reader reader, int readAheadSize)

  - ### ReaderCharacterSource

    public ReaderCharacterSource(Reader reader)

  - ### ReaderCharacterSource

    public ReaderCharacterSource(String string)

- ## Method Details

  - ### nextChar

    public final int nextChar()
    Description copied from interface: `CharacterSource`
    returns the next character moving the file pointer or index to the next location.
    Specified by:
      `nextChar` in interface `CharacterSource`

  - ### currentChar

    public final int currentChar()
    Description copied from interface: `CharacterSource`
    returns the current character without changing the IO pointer or index.
    Specified by:
      `currentChar` in interface `CharacterSource`

  - ### hasChar

    public final boolean hasChar()
    Description copied from interface: `CharacterSource`
    Checks to see if there is a next character.
    Specified by:
      `hasChar` in interface `CharacterSource`

  - ### consumeIfMatch

    public final boolean consumeIfMatch(char[] match)
    Description copied from interface: `CharacterSource`
    Useful for finding constants in a string like true, false, etc.
    Specified by:
      `consumeIfMatch` in interface `CharacterSource`

  - ### location

    public final int location()
    Description copied from interface: `CharacterSource`
    This is mostly for debugging and testing.
    Specified by:
      `location` in interface `CharacterSource`

  - ### safeNextChar

    public final int safeNextChar()
    Description copied from interface: `CharacterSource`
    Combines the operations of nextChar and hasChar. Characters is -1 if not found which signifies end of file. This might be preferable to avoid two method calls.
    Specified by:
      `safeNextChar` in interface `CharacterSource`

  - ### findNextChar

    public char[] findNextChar(int match, int esc)
    Description copied from interface: `CharacterSource`
    Used to find strings and their ilk Finds the next non-escaped char
    Specified by:
      `findNextChar` in interface `CharacterSource`
    Parameters:
      `match` - character to find
      `esc` - escape character to avoid next char if escaped
    Returns:
      list of chars until this is found.

  - ### hadEscape

    public boolean hadEscape()
    Specified by:
      `hadEscape` in interface `CharacterSource`

  - ### skipWhiteSpace

    public void skipWhiteSpace()
    Description copied from interface: `CharacterSource`
    Skip white space.
    Specified by:
      `skipWhiteSpace` in interface `CharacterSource`

  - ### readNumber

    public char[] readNumber()
    Description copied from interface: `CharacterSource`
    Reads a number from the character source.
    Specified by:
      `readNumber` in interface `CharacterSource`

  - ### errorDetails

    public String errorDetails(String message)
    Specified by:
      `errorDetails` in interface `CharacterSource`