Package org.simpleframework.xml.stream
Class StreamProvider
java.lang.Object
org.simpleframework.xml.stream.StreamProvider
- All Implemented Interfaces:
Provider
The
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XMLInputFactory
This is the factory that is used to create StAX parsers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprovide
(InputStream source) This provides anEventReader
that will read from the specified input stream.This provides anEventReader
that will read from the specified reader.private EventReader
provide
(XMLEventReader source) This provides anEventReader
that will read from the specified reader.
-
Field Details
-
factory
This is the factory that is used to create StAX parsers.
-
-
Constructor Details
-
StreamProvider
public StreamProvider()Constructor for theStreamProvider
object. This is used to instantiate a parser factory that will be used to create parsers when requested. Instantiating the factory up front also checks that the framework is fully supported.
-
-
Method Details
-
provide
This provides anEventReader
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. -
provide
This provides anEventReader
that will read from the specified reader. When reading from a reader the character encoding should be the same as the source XML document. -
provide
This provides anEventReader
that will read from the specified reader. The returned event reader is basically a wrapper for the provided StAX implementation.- Parameters:
source
- this is the reader to read the document with- Returns:
- this is used to return the event reader implementation
- Throws:
Exception
-