public class JSONLexer
extends java.lang.Object
implements java.io.Closeable
Unlike traditional lexers, which are normally generated, this one is implemented by hand. A normal implementation would rely on a DFA, this one encapsulates substates in subroutines.
| Constructor and Description |
|---|
JSONLexer(java.io.Reader input)
Constructor taking a
Reader from where to read the JSON data. |
JSONLexer(java.lang.String input)
Constructor taking the JSON string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
JSONToken |
nextToken()
Get the next token, or
null if no next token is available. |
public JSONLexer(java.lang.String input)
input - JSON string for lexical analysis.public JSONLexer(java.io.Reader input)
Reader from where to read the JSON data.input - A Reader instance from where to read the JSON data.public JSONToken nextToken() throws LexerException
null if no next token is available.JSONToken or null if there is no next token.LexerExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException