/**
* A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
* asynchronously.
- *
+ *
* <p>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:
- *
+ *
* <pre>
* JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'");
* JsonElement element;
* @since 1.4
*/
public JsonStreamParser(String json) {
- this(new StringReader(json));
+ this(new StringReader(json));
}
-
+
/**
* @param reader The data stream containing JSON elements concatenated to each other.
* @since 1.4
parser.setLenient(true);
lock = new Object();
}
-
+
/**
* Returns the next available {@link JsonElement} on the reader. Null if none available.
- *
+ *
* @return the next available {@link JsonElement} on the reader. Null if none available.
* @throws JsonParseException if the incoming stream is malformed JSON.
* @since 1.4
if (!hasNext()) {
throw new NoSuchElementException();
}
-
+
try {
return Streams.parse(parser);
} catch (StackOverflowError e) {