public static class ContentStreamBase.StringStream extends ContentStreamBase
ContentStream
from a String
ContentStreamBase.ByteArrayStream, ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream
contentType, DEFAULT_CHARSET, name, size, sourceInfo
Constructor and Description |
---|
ContentStreamBase.StringStream(String str) |
Modifier and Type | Method and Description |
---|---|
String |
getContentType() |
Reader |
getReader()
If an charset is defined (by the contentType) use that, otherwise
use a StringReader
|
InputStream |
getStream()
Get an open stream.
|
getCharsetFromContentType, getName, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfo
public ContentStreamBase.StringStream(String str)
public String getContentType()
getContentType
in interface ContentStream
getContentType
in class ContentStreamBase
public InputStream getStream() throws 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.IOException
public Reader getReader() throws IOException
getReader
in interface ContentStream
getReader
in class ContentStreamBase
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.