com.unboundid.util.json
Class JSONObjectReader

java.lang.Object
  extended by com.unboundid.util.json.JSONObjectReader
All Implemented Interfaces:
java.io.Closeable

@ThreadSafety(level=NOT_THREADSAFE)
public final class JSONObjectReader
extends java.lang.Object
implements java.io.Closeable

This class provides a mechanism for reading JSON objects from an input stream. It assumes that any non-ASCII data that may be read from the input stream is encoded as UTF-8.


Constructor Summary
JSONObjectReader(java.io.InputStream inputStream)
          Creates a new JSON object reader that will read objects from the provided input stream.
 
Method Summary
 void close()
          Closes this JSON object reader and the underlying input stream.
 JSONObject readObject()
          Reads the next JSON object from the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONObjectReader

public JSONObjectReader(java.io.InputStream inputStream)
Creates a new JSON object reader that will read objects from the provided input stream.

Parameters:
inputStream - The input stream from which the data should be read.
Method Detail

readObject

public JSONObject readObject()
                      throws java.io.IOException,
                             JSONException
Reads the next JSON object from the input stream.

Returns:
The JSON object that was read, or null if the end of the end of the stream has been reached..
Throws:
java.io.IOException - If a problem is encountered while reading from the input stream.
JSONException - If the data read

close

public void close()
           throws java.io.IOException
Closes this JSON object reader and the underlying input stream.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException - If a problem is encountered while closing the underlying input stream.