[Java] Interface CharacterSource
public interface CharacterSource
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public boolean |
consumeIfMatch(char[] match) Useful for finding constants in a string like true, false, etc. | |
public int |
currentChar() returns the current character without changing the IO pointer or index. | |
public String |
errorDetails(String message) | |
public char[] |
findNextChar(int ch, int esc) Used to find strings and their ilk Finds the next non-escaped char | |
public boolean |
hadEscape() | |
public boolean |
hasChar() Checks to see if there is a next character. | |
public int |
location() This is mostly for debugging and testing. | |
public int |
nextChar() returns the next character moving the file pointer or index to the next location. | |
public char[] |
readNumber() Reads a number from the character source. | |
public int |
safeNextChar() Combines the operations of nextChar and hasChar. | |
public void |
skipWhiteSpace() Skip white space. |
Method Detail
public boolean consumeIfMatch(char[] match)
Useful for finding constants in a string like true, false, etc.
public int currentChar()
returns the current character without changing the IO pointer or index.
public String errorDetails(String message)
public char[] findNextChar(int ch, int esc)
Used to find strings and their ilk Finds the next non-escaped char
- Parameters:
-
ch
- character to find -
esc
- escape character to avoid next char if escaped
- Returns:
- list of chars until this is found.
public boolean hadEscape()
public boolean hasChar()
Checks to see if there is a next character.
public int location()
This is mostly for debugging and testing.
public int nextChar()
returns the next character moving the file pointer or index to the next location.
public char[] readNumber()
Reads a number from the character source.
public int safeNextChar()
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.
public void skipWhiteSpace()
Skip white space.
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/apache/groovy/json/internal/CharacterSource.html