Package org.simpleframework.xml.stream
Class PullProvider
- java.lang.Object
-
- org.simpleframework.xml.stream.PullProvider
-
- All Implemented Interfaces:
Provider
class PullProvider extends java.lang.Object implements Provider
ThePullProvider
class is used to provide an event reader that uses the XML pull API available on Google Android. It provides the best performance on Android as it avoids having to build a full DOM model. TheEventReader
produced by this provider will have full namespace capabilities and also has line numbers available for each of the events that are extracted.
-
-
Field Summary
Fields Modifier and Type Field Description private org.xmlpull.v1.XmlPullParserFactory
factory
This is used to create a new XML pull parser for the reader.
-
Constructor Summary
Constructors Constructor Description PullProvider()
Constructor for thePullProvider
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventReader
provide(java.io.InputStream source)
This provides anEventReader
that will read from the specified input stream.EventReader
provide(java.io.Reader source)
This provides anEventReader
that will read from the specified reader.
-
-
-
Constructor Detail
-
PullProvider
public PullProvider() throws java.lang.Exception
Constructor for thePullProvider
object. This will instantiate a namespace aware pull parser factory that will be used to parse the XML documents that are read by the framework. If XML pull is not available this will fail.- Throws:
java.lang.Exception
-
-
Method Detail
-
provide
public EventReader provide(java.io.InputStream source) throws java.lang.Exception
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
public EventReader provide(java.io.Reader source) throws java.lang.Exception
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.
-
-