public class StreamSource extends java.lang.Object implements SingleUseSource
writeTo()
method will result in all data being consumed immediately, assuming no error occurs. The pull-based getInputStream()
actually gives the underlying InputStream directly to the caller.DEFAULT_CHARACTER_SET_ENCODING
Constructor and Description |
---|
StreamSource(java.io.InputStream inputStream) |
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream(TransformOptions options)
Returns streaming byte-baseed representation of the Source's content.
|
boolean |
isConsumed()
Indicates if the Source has already been consumed
|
int |
peek(byte[] b, int off, int len)
Peek bytes from the input stream without consuming the input stream.
|
void |
writeTo(java.io.OutputStream out, TransformOptions options)
Serializes the Source's content to a byte-based stream.
|
public StreamSource(java.io.InputStream inputStream)
inputStream
- A valid InputStream reference to an XML stream.public java.io.InputStream getInputStream(TransformOptions options)
Source
getInputStream
in interface Source
options
- Options used to affect the serializationpublic void writeTo(java.io.OutputStream out, TransformOptions options) throws java.io.IOException
Source
Note that this method may involve an internal transformation, although it should not in any way change the underlying content.
public boolean isConsumed()
SingleUseSource
isConsumed
in interface SingleUseSource
public int peek(byte[] b, int off, int len) throws java.io.IOException
read
b
- bytes array to copy bytes tooff
- start offset for bytes to copylen
- length of bytes to copyjava.io.IOException
- an I/O Exception occurred