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 java.lang.Object implements CharacterSource
- 
Constructor SummaryConstructors Constructor Description ReaderCharacterSource(java.io.Reader reader)ReaderCharacterSource(java.io.Reader reader, int readAheadSize)ReaderCharacterSource(java.lang.String string)
- 
Method SummaryModifier and Type Method Description booleanconsumeIfMatch(char[] match)Useful for finding constants in a string like true, false, etc.intcurrentChar()returns the current character without changing the IO pointer or index.java.lang.StringerrorDetails(java.lang.String message)char[]findNextChar(int match, int esc)Used to find strings and their ilk Finds the next non-escaped charbooleanhadEscape()booleanhasChar()Checks to see if there is a next character.intlocation()This is mostly for debugging and testing.intnextChar()returns the next character moving the file pointer or index to the next location.char[]readNumber()Reads a number from the character source.intsafeNextChar()Combines the operations of nextChar and hasChar.voidskipWhiteSpace()Skip white space.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
ReaderCharacterSourcepublic ReaderCharacterSource(java.io.Reader reader, int readAheadSize)
- 
ReaderCharacterSourcepublic ReaderCharacterSource(java.io.Reader reader)
- 
ReaderCharacterSourcepublic ReaderCharacterSource(java.lang.String string)
 
- 
- 
Method Details- 
nextCharpublic final int nextChar()Description copied from interface:CharacterSourcereturns the next character moving the file pointer or index to the next location.- Specified by:
- nextCharin interface- CharacterSource
 
- 
currentCharpublic final int currentChar()Description copied from interface:CharacterSourcereturns the current character without changing the IO pointer or index.- Specified by:
- currentCharin interface- CharacterSource
 
- 
hasCharpublic final boolean hasChar()Description copied from interface:CharacterSourceChecks to see if there is a next character.- Specified by:
- hasCharin interface- CharacterSource
 
- 
consumeIfMatchpublic final boolean consumeIfMatch(char[] match)Description copied from interface:CharacterSourceUseful for finding constants in a string like true, false, etc.- Specified by:
- consumeIfMatchin interface- CharacterSource
 
- 
locationpublic final int location()Description copied from interface:CharacterSourceThis is mostly for debugging and testing.- Specified by:
- locationin interface- CharacterSource
 
- 
safeNextCharpublic final int safeNextChar()Description copied from interface:CharacterSourceCombines 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:
- safeNextCharin interface- CharacterSource
 
- 
findNextCharpublic char[] findNextChar(int match, int esc)Description copied from interface:CharacterSourceUsed to find strings and their ilk Finds the next non-escaped char- Specified by:
- findNextCharin interface- CharacterSource
- Parameters:
- match- character to find
- esc- escape character to avoid next char if escaped
- Returns:
- list of chars until this is found.
 
- 
hadEscapepublic boolean hadEscape()- Specified by:
- hadEscapein interface- CharacterSource
 
- 
skipWhiteSpacepublic void skipWhiteSpace()Description copied from interface:CharacterSourceSkip white space.- Specified by:
- skipWhiteSpacein interface- CharacterSource
 
- 
readNumberpublic char[] readNumber()Description copied from interface:CharacterSourceReads a number from the character source.- Specified by:
- readNumberin interface- CharacterSource
 
- 
errorDetailspublic java.lang.String errorDetails(java.lang.String message)- Specified by:
- errorDetailsin interface- CharacterSource
 
 
-