Skip to content

Commit

Permalink
Merge pull request #1786 from Marcono1234/marcono1234/JsonStreamParse…
Browse files Browse the repository at this point in the history
…r-doc-fix

Improve incorrect JsonStreamParser doc
  • Loading branch information
eamonnmcmanus authored May 13, 2021
2 parents 8a6af9d + b1edb70 commit 829a514
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions gson/src/main/java/com/google/gson/JsonStreamParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@

/**
* A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
* asynchronously.
*
* asynchronously. The JSON data is parsed in lenient mode, see also
* {@link JsonReader#setLenient(boolean)}.
*
* <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:
Expand Down Expand Up @@ -72,10 +73,12 @@ public JsonStreamParser(Reader reader) {
}

/**
* 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.
* Returns the next available {@link JsonElement} on the reader. Throws a
* {@link NoSuchElementException} if no element is available.
*
* @return the next available {@code JsonElement} on the reader.
* @throws JsonSyntaxException if the incoming stream is malformed JSON.
* @throws NoSuchElementException if no {@code JsonElement} is available.
* @since 1.4
*/
public JsonElement next() throws JsonParseException {
Expand All @@ -97,6 +100,7 @@ public JsonElement next() throws JsonParseException {
/**
* Returns true if a {@link JsonElement} is available on the input for consumption
* @return true if a {@link JsonElement} is available on the input, false otherwise
* @throws JsonSyntaxException if the incoming stream is malformed JSON.
* @since 1.4
*/
public boolean hasNext() {
Expand Down

0 comments on commit 829a514

Please sign in to comment.