public static class ContentStreamBase.StringStream extends ContentStreamBase
ContentStream
from a File
ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
str |
contentType, DEFAULT_CHARSET, name, size, sourceInfo
Constructor and Description |
---|
StringStream(java.lang.String str) |
Modifier and Type | Method and Description |
---|---|
java.io.Reader |
getReader()
If an charset is defined (by the contentType) use that, otherwise
use a StringReader
|
java.io.InputStream |
getStream()
Get an open stream.
|
getCharsetFromContentType, getContentType, getName, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfo
public java.io.InputStream getStream() throws java.io.IOException
ContentStream
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.java.io.IOException
public java.io.Reader getReader() throws java.io.IOException
getReader
in interface ContentStream
getReader
in class ContentStreamBase
java.io.IOException