com.splunk
Class ResultsReaderJson

java.lang.Object
  extended by com.splunk.ResultsReader
      extended by com.splunk.ResultsReaderJson

public class ResultsReaderJson
extends ResultsReader

The ResultsReaderJson class represents a streaming JSON reader for Splunk search results. This class requires the gson-2.1.jar file in your build path.


Constructor Summary
ResultsReaderJson(java.io.InputStream inputStream)
          Class constructor.
 
Method Summary
 void close()
          Closes the reader and returns resources.
 Event getNextEvent()
          Returns the next event in the event stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultsReaderJson

public ResultsReaderJson(java.io.InputStream inputStream)
                  throws java.io.IOException
Class constructor. Constructs a streaming JSON reader for the event stream. You should only attempt to parse a JSON stream with the JSON reader. Using a non-JSON stream yields unpredictable results.

Parameters:
inputStream - The stream to parse.
Throws:
java.lang.Exception - On exception.
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Closes the reader and returns resources.

Overrides:
close in class ResultsReader
Throws:
java.io.IOException - On IO exception.

getNextEvent

public Event getNextEvent()
                   throws java.io.IOException
Returns the next event in the event stream.

Specified by:
getNextEvent in class ResultsReader
Returns:
The map of key-value pairs for an event. The format of multi-item values is implementation-specific. We recommend using the methods from the Event class to interpret multi-item values.
Throws:
java.io.IOException - On IO exception.