Class PullProvider

java.lang.Object
org.simpleframework.xml.stream.PullProvider
All Implemented Interfaces:
Provider

class PullProvider extends Object implements Provider
The PullProvider 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. The EventReader 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 final org.xmlpull.v1.XmlPullParserFactory
    This is used to create a new XML pull parser for the reader.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the PullProvider object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This provides an EventReader that will read from the specified input stream.
    provide(Reader source)
    This provides an EventReader that will read from the specified reader.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • factory

      private final org.xmlpull.v1.XmlPullParserFactory factory
      This is used to create a new XML pull parser for the reader.
  • Constructor Details

    • PullProvider

      public PullProvider() throws Exception
      Constructor for the PullProvider 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:
      Exception
  • Method Details

    • provide

      public EventReader provide(InputStream source) throws Exception
      This provides an 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.
      Specified by:
      provide in interface Provider
      Parameters:
      source - this is the stream to read the document with
      Returns:
      this is used to return the event reader implementation
      Throws:
      Exception
    • provide

      public EventReader provide(Reader source) throws Exception
      This provides an 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.
      Specified by:
      provide in interface Provider
      Parameters:
      source - this is the reader to read the document with
      Returns:
      this is used to return the event reader implementation
      Throws:
      Exception