Class XMLPullReaderFactory

  • All Implemented Interfaces:
    IXMLReaderFactory

    public class XMLPullReaderFactory
    extends java.lang.Object
    implements IXMLReaderFactory
    Factory for creating XMLPull parser instances.
    Author:
    Dennis M. Sosnoski
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  XMLPullReaderFactory.XMLPullReader
      Wrapper for an XMLPull parser implementation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String DEFAULT_PARSER_NAME
      Default parser factory name when nothing else found.
      private XmlPullParserFactory m_factory
      Factory used for constructing parser instances.
      private static XMLPullReaderFactory s_instance
      Singleton instance of class.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private XMLPullReaderFactory​(XmlPullParserFactory factory)
      Internal constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private XmlPullParser createParser​(boolean nsf)
      Create new parser instance.
      IXMLReader createReader​(java.io.InputStream is, java.lang.String name, java.lang.String enc, boolean nsf)
      Get new XML reader instance for document from input stream.
      IXMLReader createReader​(java.io.Reader rdr, java.lang.String name, boolean nsf)
      Get new XML reader instance for document from reader.
      static XMLPullReaderFactory getInstance()
      Get instance of factory.
      IXMLReader recycleReader​(IXMLReader old, java.io.InputStream is, java.lang.String name, java.lang.String enc)
      Recycle XML reader instance for new document from input stream.
      IXMLReader recycleReader​(IXMLReader old, java.io.Reader rdr, java.lang.String name)
      Recycle XML reader instance for document from reader.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_PARSER_NAME

        private static final java.lang.String DEFAULT_PARSER_NAME
        Default parser factory name when nothing else found.
        See Also:
        Constant Field Values
      • m_factory

        private final XmlPullParserFactory m_factory
        Factory used for constructing parser instances.
    • Constructor Detail

      • XMLPullReaderFactory

        private XMLPullReaderFactory​(XmlPullParserFactory factory)
        Internal constructor.
        Parameters:
        factory -
    • Method Detail

      • getInstance

        public static XMLPullReaderFactory getInstance()
        Get instance of factory.
        Returns:
        factory instance
      • createParser

        private XmlPullParser createParser​(boolean nsf)
                                    throws XmlPullParserException
        Create new parser instance.
        Parameters:
        nsf - enable namespace processing on parser flag
        Returns:
        parser instance
        Throws:
        XmlPullParserException - on error creating parser
      • createReader

        public IXMLReader createReader​(java.io.InputStream is,
                                       java.lang.String name,
                                       java.lang.String enc,
                                       boolean nsf)
                                throws JiBXException
        Description copied from interface: IXMLReaderFactory
        Get new XML reader instance for document from input stream.
        Specified by:
        createReader in interface IXMLReaderFactory
        Parameters:
        is - document input stream
        name - document name (null if unknown)
        enc - document character encoding (null if unknown)
        nsf - namespaces enabled flag
        Returns:
        new reader instance for document
        Throws:
        JiBXException - on parser configuration error
      • createReader

        public IXMLReader createReader​(java.io.Reader rdr,
                                       java.lang.String name,
                                       boolean nsf)
                                throws JiBXException
        Description copied from interface: IXMLReaderFactory
        Get new XML reader instance for document from reader.
        Specified by:
        createReader in interface IXMLReaderFactory
        Parameters:
        rdr - document reader
        name - document name (null if unknown)
        nsf - namespaces enabled flag
        Returns:
        new reader instance for document
        Throws:
        JiBXException - on parser configuration error
      • recycleReader

        public IXMLReader recycleReader​(IXMLReader old,
                                        java.io.InputStream is,
                                        java.lang.String name,
                                        java.lang.String enc)
                                 throws JiBXException
        Description copied from interface: IXMLReaderFactory
        Recycle XML reader instance for new document from input stream. If the supplied reader can be reused it will be configured for the new document and returned; otherwise, a new reader will be created for the document. The namespace enabled state of the returned reader is always the same as that of the supplied reader.
        Specified by:
        recycleReader in interface IXMLReaderFactory
        Parameters:
        old - reader instance to be recycled
        is - document input stream
        name - document name (null if unknown)
        enc - document character encoding (null if unknown)
        Returns:
        new reader instance for document
        Throws:
        JiBXException - on parser configuration error
      • recycleReader

        public IXMLReader recycleReader​(IXMLReader old,
                                        java.io.Reader rdr,
                                        java.lang.String name)
                                 throws JiBXException
        Description copied from interface: IXMLReaderFactory
        Recycle XML reader instance for document from reader. If the supplied reader can be reused it will be configured for the new document and returned; otherwise, a new reader will be created for the document. The namespace enabled state of the returned reader is always the same as that of the supplied reader.
        Specified by:
        recycleReader in interface IXMLReaderFactory
        Parameters:
        old - reader instance to be recycled
        rdr - document reader
        name - document name (null if unknown)
        Returns:
        new reader instance for document
        Throws:
        JiBXException - on parser configuration error