JsonElements from the specified reader
asynchronously. The JSON data is parsed in lenient mode, see also JsonReader#setStrictness(Strictness).
This class is conditionally thread-safe (see Item 70, Effective Java second edition). To properly use this class across multiple threads, you will need to add some external synchronization. For example:
JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'");
JsonElement element;
synchronized (parser) { // synchronize on an object shared by threads
if (parser.hasNext()) {
element = parser.next();
}
}
| Modifier and Type | Field and Description |
|---|---|
| private final Object | |
| private final JsonReader |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if aJsonElement is available on the input, false otherwiseImplements java. Returns true if a |
| public JsonElement | Returns: the next availableJsonElement on the reader.Implements java. Returns the next available |
| public void | remove()
Overrides default java. This optional |
| lock | back to summary |
|---|---|
| private final Object lock | |
| parser | back to summary |
|---|---|
| private final JsonReader parser | |
| JsonStreamParser | back to summary |
|---|---|
public JsonStreamParser(String json)
| |
| JsonStreamParser | back to summary |
|---|---|
public JsonStreamParser(Reader reader)
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Returns true if a
| |
| next | back to summary |
|---|---|
| public JsonElement next() throws JsonParseException Implements java. Returns the next available
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. This optional
| |