Groovy Documentation

groovy.json
[Java] Class JsonLexer

java.lang.Object
  groovy.json.JsonLexer
All Implemented Interfaces:
java.util.Iterator

public class JsonLexer

The lexer reads JSON tokens in a streaming fashion from the underlying reader.

Authors:
Guillaume Laforge
Since:
1.8.0


Constructor Summary
JsonLexer(java.io.Reader reader)

Instanciates a lexer with a reader from which to read JSON tokens.

 
Method Summary
LineColumnReader getReader()

Underlying reader from which to read the JSON tokens.

boolean hasNext()

Iterator method to know if another token follows, or if we've reached the end of the stream.

JsonToken next()

Iterator method to get the next token of the stream.

JsonToken nextToken()

@return the next token from the stream

void remove()

Method not implemented.

int skipWhitespace()

Skips all the whitespace characters and moves the cursor to the next non-space character.

static java.lang.String unescape(java.lang.String input)

Replace unicode escape and other control characters with real characters

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

JsonLexer

public JsonLexer(java.io.Reader reader)
Instanciates a lexer with a reader from which to read JSON tokens. Under the hood, the reader is wrapped in a LineColumnReader, for line and column information, unless it's already an instance of that class.
Parameters:
reader - underlying reader


 
Method Detail

getReader

public LineColumnReader getReader()
Underlying reader from which to read the JSON tokens. This reader is an instance of LineColumnReader, to keep track of line and column positions.


hasNext

public boolean hasNext()
Iterator method to know if another token follows, or if we've reached the end of the stream.
Returns:
true if there are more tokens


next

public JsonToken next()
Iterator method to get the next token of the stream.
Returns:
the next token


nextToken

public JsonToken nextToken()
Returns:
the next token from the stream


remove

public void remove()
Method not implemented.
throws:
UnsupportedOperationException


skipWhitespace

public int skipWhitespace()
Skips all the whitespace characters and moves the cursor to the next non-space character.


unescape

public static java.lang.String unescape(java.lang.String input)
Replace unicode escape and other control characters with real characters
Parameters:
input - text
Returns:
input text without the escaping


 

Groovy Documentation