Class PullProvider

  • All Implemented Interfaces:
    Provider

    class PullProvider
    extends java.lang.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 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 the PullProvider object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

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

      • factory

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

      • PullProvider

        public PullProvider()
                     throws java.lang.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:
        java.lang.Exception
    • Method Detail

      • provide

        public EventReader provide​(java.io.InputStream source)
                            throws java.lang.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:
        java.lang.Exception
      • provide

        public EventReader provide​(java.io.Reader source)
                            throws java.lang.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:
        java.lang.Exception