Package org.apache.solr.common.util
Class ContentStreamBase.FileStream
- java.lang.Object
-
- org.apache.solr.common.util.ContentStreamBase
-
- org.apache.solr.common.util.ContentStreamBase.FileStream
-
- All Implemented Interfaces:
ContentStream
- Enclosing class:
- ContentStreamBase
public static class ContentStreamBase.FileStream extends ContentStreamBase
Construct aContentStream
from aFile
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.common.util.ContentStreamBase
ContentStreamBase.ByteArrayStream, ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream
-
-
Field Summary
-
Fields inherited from class org.apache.solr.common.util.ContentStreamBase
contentType, DEFAULT_CHARSET, name, size, sourceInfo
-
-
Constructor Summary
Constructors Constructor Description FileStream(File f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
InputStream
getStream()
Get an open stream.-
Methods inherited from class org.apache.solr.common.util.ContentStreamBase
attemptToDetermineContentType, create, getCharsetFromContentType, getName, getReader, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfo
-
-
-
-
Constructor Detail
-
FileStream
public FileStream(File f)
-
-
Method Detail
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceContentStream
- Overrides:
getContentType
in classContentStreamBase
-
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 togetStream()
orgetReader()
is guaranteed to work. The runtime behavior for additional calls is undefined. Note: you must callgetStream()
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
-
-