Package org.apache.solr.common.util
Class ContentStreamBase.StringStream
- java.lang.Object
- 
- org.apache.solr.common.util.ContentStreamBase
- 
- org.apache.solr.common.util.ContentStreamBase.StringStream
 
 
- 
- All Implemented Interfaces:
- ContentStream
 - Enclosing class:
- ContentStreamBase
 
 public static class ContentStreamBase.StringStream extends ContentStreamBase Construct aContentStreamfrom aString
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.solr.common.util.ContentStreamBaseContentStreamBase.ByteArrayStream, ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream
 
- 
 - 
Field Summary- 
Fields inherited from class org.apache.solr.common.util.ContentStreamBaseAPPLICATION_GZIP, APPLICATION_JSON, APPLICATION_OCTET_STREAM, APPLICATION_XML, contentType, DEFAULT_CHARSET, name, size, sourceInfo, TEXT_XML
 
- 
 - 
Constructor SummaryConstructors Constructor Description StringStream(String str)StringStream(String str, String contentType)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Stringdetect(String str)ReadergetReader()If an charset is defined (by the contentType) use that, otherwise use a StringReaderInputStreamgetStream()Get an open stream.- 
Methods inherited from class org.apache.solr.common.util.ContentStreamBaseattemptToDetermineContentType, create, getCharsetFromContentType, getContentType, getName, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfo
 
- 
 
- 
- 
- 
Method Detail- 
getStreampublic InputStream getStream() throws IOException Description copied from interface:ContentStreamGet 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 togetStream()orgetReader()is guaranteed to work. The runtime behavior for additional calls is undefined.Note: you must call getStream()orgetReader()before the attributes (name, contentType, etc) are guaranteed to be set. Streams may be lazy loaded only when this method is called.- Throws:
- IOException
 
 - 
getReaderpublic Reader getReader() throws IOException If an charset is defined (by the contentType) use that, otherwise use a StringReader- Specified by:
- getReaderin interface- ContentStream
- Overrides:
- getReaderin class- ContentStreamBase
- Throws:
- IOException
 
 
- 
 
-