com.splunk
Class ResultsReaderXml

java.lang.Object
  extended by com.splunk.ResultsReader
      extended by com.splunk.ResultsReaderXml
All Implemented Interfaces:
SearchResults, java.lang.Iterable<Event>

public class ResultsReaderXml
extends ResultsReader

The ResultsReaderXml class represents a streaming XML reader for Splunk search results. When a stream from an export search is passed to this reader, it skips any preview events in the stream. If you want to access the preview events, use the MultiResultsReaderXml class.


Field Summary
 
Fields inherited from class com.splunk.ResultsReader
inputStream
 
Constructor Summary
ResultsReaderXml(java.io.InputStream inputStream)
          Class constructor.
 
Method Summary
 void close()
          Closes the reader and returns resources.
 java.util.Collection<java.lang.String> getFields()
          Returns a collection of field names from the results.
 boolean isPreview()
          Indicates whether the results are a preview from an unfinished search.
 
Methods inherited from class com.splunk.ResultsReader
getNextEvent, iterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultsReaderXml

public ResultsReaderXml(java.io.InputStream inputStream)
                 throws java.io.IOException
Class constructor. Constructs a streaming XML reader for the event stream. You should only attempt to parse an XML stream with this reader. If you attempt to parse a different type of stream, unpredictable results may occur.
The pushback reader modifies export streams to generate non-strict XML at the beginning of the stream. The streaming reader ignores preview data, and only extracts finalized data.

Parameters:
inputStream - The XML stream to parse.
Throws:
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.

isPreview

public boolean isPreview()
Indicates whether the results are a preview from an unfinished search.

Returns:
true if the results are a preview, false if not.

getFields

public java.util.Collection<java.lang.String> getFields()
Returns a collection of field names from the results.

Returns:
A collection of field names.

Note that any given result will contain a subset of these fields.