Class CharSourceBootstrapper

  • All Implemented Interfaces:
    XmlConsts

    public final class CharSourceBootstrapper
    extends InputBootstrapper
    Class that takes care of bootstrapping main document input from a Stream input source.
    • Field Detail

      • DEFAULT_BUFFER_SIZE

        static final int DEFAULT_BUFFER_SIZE
        Whether to use a bigger (4000, ie. 8k) or smaller (2000 -> 4k) buffer size?
        See Also:
        Constant Field Values
      • _in

        final java.io.Reader _in
        Underlying Reader to use for reading content.
      • _inputBuffer

        final char[] _inputBuffer
      • _inputPtr

        private int _inputPtr
      • _inputLast

        private int _inputLast
        Offset of the first character after the end of valid buffer contents.
    • Constructor Detail

      • CharSourceBootstrapper

        private CharSourceBootstrapper​(ReaderConfig cfg,
                                       java.io.Reader r)
      • CharSourceBootstrapper

        private CharSourceBootstrapper​(ReaderConfig cfg,
                                       char[] buffer,
                                       int start,
                                       int len)
    • Method Detail

      • construct

        public static CharSourceBootstrapper construct​(ReaderConfig cfg,
                                                       java.io.Reader r)
                                                throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • construct

        public static CharSourceBootstrapper construct​(ReaderConfig cfg,
                                                       char[] buffer,
                                                       int start,
                                                       int len)
                                                throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • bootstrap

        public final XmlScanner bootstrap()
                                   throws javax.xml.stream.XMLStreamException
        Description copied from class: InputBootstrapper
        Main bootstrapping method, which will try to open the underlying input source, check its encoding, read xml declaration if there is one, and finally create a scanner for actual parsing.
        Specified by:
        bootstrap in class InputBootstrapper
        Throws:
        javax.xml.stream.XMLStreamException
      • doBootstrap

        public XmlScanner doBootstrap()
                               throws java.io.IOException,
                                      javax.xml.stream.XMLStreamException
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • verifyXmlEncoding

        protected java.lang.String verifyXmlEncoding​(java.lang.String enc)
                                              throws javax.xml.stream.XMLStreamException
        Returns:
        Normalized encoding name
        Throws:
        javax.xml.stream.XMLStreamException
      • initialLoad

        protected boolean initialLoad​(int minimum)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • loadMore

        protected void loadMore()
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • getNext

        protected int getNext()
                       throws java.io.IOException,
                              javax.xml.stream.XMLStreamException
        Specified by:
        getNext in class InputBootstrapper
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • getNextAfterWs

        protected int getNextAfterWs​(boolean reqWs)
                              throws java.io.IOException,
                                     javax.xml.stream.XMLStreamException
        Specified by:
        getNextAfterWs in class InputBootstrapper
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • checkKeyword

        protected int checkKeyword​(java.lang.String exp)
                            throws java.io.IOException,
                                   javax.xml.stream.XMLStreamException
        Specified by:
        checkKeyword in class InputBootstrapper
        Returns:
        First character that does not match expected, if any; CHAR_NULL if match succeeded
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • readQuotedValue

        protected int readQuotedValue​(char[] kw,
                                      int quoteChar)
                               throws java.io.IOException,
                                      javax.xml.stream.XMLStreamException
        Specified by:
        readQuotedValue in class InputBootstrapper
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • nextChar

        protected char nextChar()
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • skipCRLF

        protected void skipCRLF​(char lf)
                         throws java.io.IOException,
                                javax.xml.stream.XMLStreamException
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException