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
Three concrete implementations for ContentStream - one for File/URL/String
- Since:
- solr 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConstruct aContentStreamfrom aFilestatic classConstruct aContentStreamfrom aFilestatic classConstruct aContentStreamfrom aStringstatic classConstruct aContentStreamfrom aURLThis uses aURLConnectionto get the content stream -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringstatic ContentStreamcreate(RequestWriter requestWriter, SolrRequest req) static StringgetCharsetFromContentType(String contentType) getName()Base reader implementation.getSize()voidsetContentType(String contentType) voidvoidvoidsetSourceInfo(String sourceInfo) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.common.util.ContentStream
getStream
-
Field Details
-
DEFAULT_CHARSET
-
TEXT_XML
- See Also:
-
APPLICATION_OCTET_STREAM
- See Also:
-
APPLICATION_GZIP
- See Also:
-
APPLICATION_XML
- See Also:
-
APPLICATION_JSON
- See Also:
-
name
-
sourceInfo
-
contentType
-
size
-
-
Constructor Details
-
ContentStreamBase
public ContentStreamBase()
-
-
Method Details
-
getCharsetFromContentType
-
attemptToDetermineContentType
-
getReader
Base reader implementation. If the contentType declares a charset use it, otherwise use "utf-8".- Specified by:
getReaderin interfaceContentStream- Throws:
IOException
-
getContentType
- Specified by:
getContentTypein interfaceContentStream
-
setContentType
-
getName
- Specified by:
getNamein interfaceContentStream
-
setName
-
getSize
- Specified by:
getSizein interfaceContentStream- Returns:
- the stream size or
nullif not known
-
setSize
-
getSourceInfo
- Specified by:
getSourceInfoin interfaceContentStream
-
setSourceInfo
-
create
- Throws:
IOException
-