/** * 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 * @since 1.4 */ public boolean hasNext() { synchronized (lock) { try { return parser.peek() != JsonToken.END_DOCUMENT; } catch (MalformedJsonException e) { throw new JsonSyntaxException(e); } catch (IOException e) { throw new JsonIOException(e); } } }
/** * @param reader The data stream containing JSON elements concatenated to each other. * @since 1.4 */ public JsonStreamParser(Reader reader) { parser = new JsonReader(reader); parser.setLenient(true); lock = new Object(); }