org.apache.solr.client.solrj.request
Class RequestWriter.LazyContentStream

java.lang.Object
  extended by org.apache.solr.client.solrj.request.RequestWriter.LazyContentStream
All Implemented Interfaces:
ContentStream
Enclosing class:
RequestWriter

public class RequestWriter.LazyContentStream
extends Object
implements ContentStream


Constructor Summary
RequestWriter.LazyContentStream(UpdateRequest req)
           
 
Method Summary
 String getContentType()
           
 String getName()
           
 Reader getReader()
          Get an open stream.
 Long getSize()
           
 String getSourceInfo()
           
 InputStream getStream()
          Get an open stream.
 void writeTo(OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestWriter.LazyContentStream

public RequestWriter.LazyContentStream(UpdateRequest req)
Method Detail

getName

public String getName()
Specified by:
getName in interface ContentStream

getSourceInfo

public String getSourceInfo()
Specified by:
getSourceInfo in interface ContentStream

getContentType

public String getContentType()
Specified by:
getContentType in interface ContentStream

getSize

public Long getSize()
Specified by:
getSize in interface ContentStream
Returns:
the stream size or null if not known

getStream

public InputStream getStream()
                      throws IOException
Description copied from interface: ContentStream
Get an open stream. You are responsible for closing it. Consider using something like:
   InputStream stream = stream.getStream();
   try {
     // use the stream...
   }
   finally {
     IOUtils.closeQuietly(stream);
   }
  
Only the first call to getStream() or getReader() is guaranteed to work. The runtime behavior for additional calls is undefined. Note: you must call getStream() or getReader() before the attributes (name, contentType, etc) are guaranteed to be set. Streams may be lazy loaded only when this method is called.

Specified by:
getStream in interface ContentStream
Throws:
IOException

getReader

public Reader getReader()
                 throws IOException
Description copied from interface: ContentStream
Get an open stream. You are responsible for closing it. Consider using something like:
   Reader reader = stream.getReader();
   try {
     // use the reader...
   }
   finally {
     IOUtils.closeQuietly(reader);
   }
  
Only the first call to getStream() or getReader() is guaranteed to work. The runtime behavior for additional calls is undefined. Note: you must call getStream() or getReader() before the attributes (name, contentType, etc) are guaranteed to be set. Streams may be lazy loaded only when this method is called.

Specified by:
getReader in interface ContentStream
Throws:
IOException

writeTo

public void writeTo(OutputStream os)
             throws IOException
Throws:
IOException


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.