@ThreadSafety(level=NOT_THREADSAFE) public final class JSONObjectReader extends java.lang.Object implements java.io.Closeable
Constructor and Description |
---|
JSONObjectReader(java.io.InputStream inputStream)
Creates a new JSON object reader that will read objects from the provided
input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this JSON object reader and the underlying input stream.
|
JSONObject |
readObject()
Reads the next JSON object from the input stream.
|
public JSONObjectReader(java.io.InputStream inputStream)
inputStream
- The input stream from which the data should be read.public JSONObject readObject() throws java.io.IOException, JSONException
null
if the end of the
end of the stream has been reached..java.io.IOException
- If a problem is encountered while reading from the
input stream.JSONException
- If the data readpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- If a problem is encountered while closing the
underlying input stream.