com.bigllc.retsiq.simpleclient
Class DelimitedSearchResponseHandler

java.lang.Object
  extended by com.bigllc.retsiq.simpleclient.AbstractSearchResponseHandler
      extended by com.bigllc.retsiq.simpleclient.DelimitedSearchResponseHandler
All Implemented Interfaces:
SearchResponseHandler

public class DelimitedSearchResponseHandler
extends AbstractSearchResponseHandler

Search handler that outputs search records in a delimited format. The default delimiter is a comma.

If a value or column header contains the supplied delimiter it will be wrapped with quotes. Any quotes within a quoted field is escaped with a quote.

Author:
Marc G. Smith

Field Summary
 
Fields inherited from class com.bigllc.retsiq.simpleclient.AbstractSearchResponseHandler
columnNameIndex, columns, currentRow, hasMoreRecords, path, query, recordCount, recordsInResponse, responseDelimiter, responseDelimiterHex, select, session
 
Constructor Summary
DelimitedSearchResponseHandler(java.io.OutputStream out)
          Create a comma delimited search response output handler.
DelimitedSearchResponseHandler(java.io.OutputStream out, boolean headers)
          Create a comma delimited search response output handler.
DelimitedSearchResponseHandler(java.io.OutputStream out, java.lang.String delimiter)
          Create a delimited search response output handler.
DelimitedSearchResponseHandler(java.io.OutputStream out, java.lang.String delimiter, boolean headers)
          Create a delimited search response output handler.
 
Method Summary
 void columnsChild(java.util.List<java.lang.String> columns)
          Override this method if derived handler wants to receive notification of columns().
 void dataChild(SearchRecord record)
          Override this method if derived handler wants to receive notification of data().
 void done()
          Flushes the output stream.
 
Methods inherited from class com.bigllc.retsiq.simpleclient.AbstractSearchResponseHandler
columns, count, countChild, data, delimiter, delimiterChild, getColumns, getHasMoreRecords, getPath, getQuery, getRecordCount, getRecordsInResponse, getResponseDelimiter, getResponseDelimiterHex, getSelect, getSession, hasMoreData, hasMoreDataChild, noRecordsFound, noRecordsFoundChild, responseCode, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelimitedSearchResponseHandler

public DelimitedSearchResponseHandler(java.io.OutputStream out)
Create a comma delimited search response output handler. The results will be written to the supplied output stream. The supplied output stream will not be closed by the handler. It is the responsibility of the caller to close the stream.

Parameters:
out - The output stream that delimited results should be sent to.

DelimitedSearchResponseHandler

public DelimitedSearchResponseHandler(java.io.OutputStream out,
                                      boolean headers)
Create a comma delimited search response output handler. The results will be written to the supplied output stream. The supplied output stream will not be closed by the handler. It is the responsibility of the caller to close the stream.

Parameters:
out - The output stream that delimited results should be sent to.
headers - Should a header row be printed out.

DelimitedSearchResponseHandler

public DelimitedSearchResponseHandler(java.io.OutputStream out,
                                      java.lang.String delimiter)
Create a delimited search response output handler. The results will be written to the supplied output stream. The supplied output stream will not be closed by the handler. It is the responsibility of the caller to close the stream.

Parameters:
out - The output stream that delimited results should be sent to.
delimiter - The delimiter to use.

DelimitedSearchResponseHandler

public DelimitedSearchResponseHandler(java.io.OutputStream out,
                                      java.lang.String delimiter,
                                      boolean headers)
Create a delimited search response output handler. The results will be written to the supplied output stream. The supplied output stream will not be closed by the handler. It is the responsibility of the caller to close the stream.

Parameters:
out - The output stream that delimited results should be sent to.
delimiter - The delimiter to use.
Method Detail

columnsChild

public void columnsChild(java.util.List<java.lang.String> columns)
                  throws RETSClientException
Description copied from class: AbstractSearchResponseHandler
Override this method if derived handler wants to receive notification of columns().

Overrides:
columnsChild in class AbstractSearchResponseHandler
Throws:
RETSClientException
See Also:
AbstractSearchResponseHandler.columnsChild(List)

dataChild

public void dataChild(SearchRecord record)
               throws RETSClientException
Description copied from class: AbstractSearchResponseHandler
Override this method if derived handler wants to receive notification of data().

Specified by:
dataChild in class AbstractSearchResponseHandler
Throws:
RETSClientException
See Also:
AbstractSearchResponseHandler.dataChild(SearchRecord)

done

public void done()
Flushes the output stream.

Specified by:
done in interface SearchResponseHandler
Overrides:
done in class AbstractSearchResponseHandler
See Also:
SearchResponseHandler.done()