public class StreamSource extends Object implements Source
Note: Due to their internal use of either a Reader or InputStream instance,
StreamSource instances may only be used once.
| Constructor and Description |
|---|
StreamSource(InputStream input)
Construct a StreamSource from a byte stream.
|
StreamSource(InputStream input,
String characterEncoding)
Construct a StreamSource from a byte stream with the specified
encoding. |
StreamSource(Reader reader)
Construct a StreamSource from a character reader.
|
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getInputStream()
Retrieves the content as binary data using a
InputStream. |
Reader |
getReader()
Retrieves the content as character data using a
Reader. |
public StreamSource(InputStream input)
input - public StreamSource(InputStream input, String characterEncoding)
encoding.
The encoding is used when getReader() is invoked to create a
reader from the underlying byte stream.input - encoding - public StreamSource(Reader reader)
reader - public InputStream getInputStream() throws IOException
InputStream.
Either this method or getReader() may be called to read the body, not both.
getInputStream in interface SourceIOExceptionpublic Reader getReader() throws IOException
Reader.
Either this method or getInputStream() may be called to read the body, not both.
getReader in interface SourceIOExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.