org.apache.solr.response
Class GenericBinaryResponseWriter

java.lang.Object
  extended by org.apache.solr.response.BaseResponseWriter
      extended by org.apache.solr.response.GenericBinaryResponseWriter
All Implemented Interfaces:
BinaryQueryResponseWriter, QueryResponseWriter, NamedListInitializedPlugin

public abstract class GenericBinaryResponseWriter
extends BaseResponseWriter
implements BinaryQueryResponseWriter

A generic QueryResponseWriter implementation that requires a user to implement the getSingleResponseWriter(OutputStream, SolrQueryRequest, SolrQueryResponse) that defines a BaseResponseWriter.SingleResponseWriter to handle the binary output.

Since:
1.5
Version:
$Id: GenericBinaryResponseWriter.java 1004075 2010-10-04 00:36:21Z rmuir $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.response.BaseResponseWriter
BaseResponseWriter.DocListInfo, BaseResponseWriter.SingleResponseWriter
 
Field Summary
 
Fields inherited from interface org.apache.solr.response.QueryResponseWriter
CONTENT_TYPE_TEXT_ASCII, CONTENT_TYPE_TEXT_UTF8, CONTENT_TYPE_XML_UTF8
 
Constructor Summary
GenericBinaryResponseWriter()
           
 
Method Summary
abstract  BaseResponseWriter.SingleResponseWriter getSingleResponseWriter(OutputStream out, SolrQueryRequest request, SolrQueryResponse response)
          Users of this class should implement this method to define a BaseResponseWriter.SingleResponseWriter responsible for writing the binary output given a SolrDocumentList or doc-by-doc, given a SolrInputDocument.
 void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response)
          Writes the binary output data using the BaseResponseWriter.SingleResponseWriter provided by a call to getSingleResponseWriter(OutputStream, SolrQueryRequest, SolrQueryResponse) .
 void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response)
          Just to throw Exception So that the eimplementing classes do not have to do the same
 
Methods inherited from class org.apache.solr.response.BaseResponseWriter
init, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.solr.response.QueryResponseWriter
getContentType, init
 

Constructor Detail

GenericBinaryResponseWriter

public GenericBinaryResponseWriter()
Method Detail

write

public void write(OutputStream out,
                  SolrQueryRequest request,
                  SolrQueryResponse response)
           throws IOException
Writes the binary output data using the BaseResponseWriter.SingleResponseWriter provided by a call to getSingleResponseWriter(OutputStream, SolrQueryRequest, SolrQueryResponse) .

Specified by:
write in interface BinaryQueryResponseWriter
Parameters:
out - The OutputStream to write the binary data to.
request - The provided SolrQueryRequest.
response - The provided SolrQueryResponse.
Throws:
IOException

getSingleResponseWriter

public abstract BaseResponseWriter.SingleResponseWriter getSingleResponseWriter(OutputStream out,
                                                                                SolrQueryRequest request,
                                                                                SolrQueryResponse response)
Users of this class should implement this method to define a BaseResponseWriter.SingleResponseWriter responsible for writing the binary output given a SolrDocumentList or doc-by-doc, given a SolrInputDocument.

Parameters:
out - The OutputStream to write the binary data response to.
request - The provided SolrQueryRequest.
response - The provided SolrQueryResponse.
Returns:
A BaseResponseWriter.SingleResponseWriter that will be used to generate the response output from this QueryResponseWriter.

write

public void write(Writer writer,
                  SolrQueryRequest request,
                  SolrQueryResponse response)
           throws IOException
Just to throw Exception So that the eimplementing classes do not have to do the same

Specified by:
write in interface QueryResponseWriter
Throws:
IOException