public static class ContentStreamBase.ByteArrayStream extends ContentStreamBase
ContentStream from a FileContentStreamBase.ByteArrayStream, ContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStreamcontentType, DEFAULT_CHARSET, name, size, sourceInfo| Constructor and Description |
|---|
ByteArrayStream(byte[] bytes,
String source) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getStream()
Get an open stream.
|
getCharsetFromContentType, getContentType, getName, getReader, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfopublic ByteArrayStream(byte[] bytes,
String source)
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.IOExceptionCopyright © 2000-2017 Apache Software Foundation. All Rights Reserved.