Class JSONLexer
- java.lang.Object
-
- com.dynatrace.openkit.util.json.lexer.JSONLexer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class JSONLexer extends java.lang.Object implements java.io.CloseableLexical analyzer for JSON, based on RFC 8259 (see also https://tools.ietf.org/html/rfc8259).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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()JSONTokennextToken()Get the next token, ornullif no next token is available.
-
-
-
Constructor Detail
-
JSONLexer
public JSONLexer(java.lang.String input)
Constructor taking the JSON string.- Parameters:
input- JSON string for lexical analysis.
-
JSONLexer
public JSONLexer(java.io.Reader input)
Constructor taking aReaderfrom where to read the JSON data.- Parameters:
input- AReaderinstance from where to read the JSON data.
-
-
Method Detail
-
nextToken
public JSONToken nextToken() throws LexerException
Get the next token, ornullif no next token is available.- Returns:
- The next
JSONTokenornullif there is no next token. - Throws:
LexerException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-