public class StreamProvider extends java.lang.Object implements Provider
StreamProvider object is used to provide event
reader implementations for StAX. Wrapping the mechanics of the
StAX framework within a Provider ensures that it can
be plugged in without any dependencies. This allows other parsers
to be swapped in should there be such a requirement.StreamProvider| Constructor and Description |
|---|
StreamProvider()
Constructor for the
StreamProvider object. |
StreamProvider(javax.xml.stream.XMLInputFactory factory)
Constructor for the
StreamProvider object using
an externally configured XML input factory. |
| Modifier and Type | Method and Description |
|---|---|
EventReader |
provide(java.io.InputStream source)
This provides an
EventReader that will read from
the specified input stream. |
EventReader |
provide(java.io.Reader source)
This provides an
EventReader that will read from
the specified reader. |
public StreamProvider(javax.xml.stream.XMLInputFactory factory)
StreamProvider object using
an externally configured XML input factory.public StreamProvider()
StreamProvider object. This constructor
uses the default XMLInputFactory.newInstance() and preconfigures the
factory with safe defaults.public EventReader provide(java.io.InputStream source) throws java.lang.Exception
EventReader that will read from
the specified input stream. When reading from an input stream
the character encoding should be taken from the XML prolog or
it should default to the UTF-8 character encoding.public EventReader provide(java.io.Reader source) throws java.lang.Exception
EventReader that will read from
the specified reader. When reading from a reader the character
encoding should be the same as the source XML document.