Package org.apache.solr.common.util
Class ContentStreamBase
- java.lang.Object
-
- org.apache.solr.common.util.ContentStreamBase
-
- All Implemented Interfaces:
ContentStream
- Direct Known Subclasses:
ContentStreamBase.ByteArrayStream,ContentStreamBase.FileStream,ContentStreamBase.StringStream,ContentStreamBase.URLStream
public abstract class ContentStreamBase extends Object implements ContentStream
Three concrete implementations for ContentStream - one for File/URL/String- Since:
- solr 1.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContentStreamBase.ByteArrayStreamConstruct aContentStreamfrom aFilestatic classContentStreamBase.FileStreamConstruct aContentStreamfrom aFilestatic classContentStreamBase.StringStreamConstruct aContentStreamfrom aStringstatic classContentStreamBase.URLStreamConstruct aContentStreamfrom aURLThis uses aURLConnectionto get the content stream
-
Field Summary
Fields Modifier and Type Field Description protected StringcontentTypestatic StringDEFAULT_CHARSETprotected Stringnameprotected Longsizeprotected StringsourceInfo
-
Constructor Summary
Constructors Constructor Description ContentStreamBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringattemptToDetermineContentType()static ContentStreamcreate(RequestWriter requestWriter, SolrRequest req)static StringgetCharsetFromContentType(String contentType)StringgetContentType()StringgetName()ReadergetReader()Base reader implementation.LonggetSize()StringgetSourceInfo()voidsetContentType(String contentType)voidsetName(String name)voidsetSize(Long size)voidsetSourceInfo(String sourceInfo)-
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.common.util.ContentStream
getStream
-
-
-
-
Method Detail
-
attemptToDetermineContentType
protected String attemptToDetermineContentType()
-
getReader
public Reader getReader() throws IOException
Base reader implementation. If the contentType declares a charset use it, otherwise use "utf-8".- Specified by:
getReaderin interfaceContentStream- Throws:
IOException
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceContentStream
-
setContentType
public void setContentType(String contentType)
-
getName
public String getName()
- Specified by:
getNamein interfaceContentStream
-
setName
public void setName(String name)
-
getSize
public Long getSize()
- Specified by:
getSizein interfaceContentStream- Returns:
- the stream size or
nullif not known
-
setSize
public void setSize(Long size)
-
getSourceInfo
public String getSourceInfo()
- Specified by:
getSourceInfoin interfaceContentStream
-
setSourceInfo
public void setSourceInfo(String sourceInfo)
-
create
public static ContentStream create(RequestWriter requestWriter, SolrRequest req) throws IOException
- Throws:
IOException
-
-