Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fasterxml.aalto.in
Class ReaderScanner

    java.lang.Object
      com.fasterxml.aalto.in.XmlScanner
          com.fasterxml.aalto.in.ReaderScanner

All Implemented Interfaces:
  XmlConsts, NamespaceContext, XMLStreamConstants

    public final class ReaderScanner

extends XmlScanner

This is the concrete scanner implementation used when input comes as a `Reader`. In general using this scanner is quite a bit less optimal than that of `InputStream` based scanner. Nonetheless, it is included for completeness, since Stax interface allows passing Readers as input sources.

Field Summary
`protected Reader` | `_in` Underlying InputStream to use for reading content.
`protected char[]` | `_inputBuffer`
`protected int` | `_inputEnd`
`protected int` | `_inputPtr`
`protected CharBasedPNameTable` | `_symbols` For now, symbol table contains prefixed names.
`protected int` | `mPastChars` Number of bytes that were read and processed before the contents of the current buffer; used for calculating absolute offsets.
`protected int` | `mRowStartOffset` Offset used to calculate the column value given current input buffer pointer.
`protected int` | `mTmpChar` Storage location for a single character that can not be pushed back (for example, multi-byte char)

Fields inherited from class com.fasterxml.aalto.in.XmlScanner
`_attrCollector, _attrCount, _cfgCoalescing, _cfgLazyParsing, _config, _currElem, _currNsCount, _currRow, _currToken, _defaultNs, _depth, _entityPending, _isEmptyTag, _lastNsContext, _lastNsDecl, _nameBuffer, _nsBindingCache, _nsBindingCount, _nsBindings, _nsBindMisses, _publicId, _systemId, _textBuilder, _tokenIncomplete, _tokenName, _xml11, CDATA_STR, INT_0, INT_9, INT_a, INT_A, INT_AMP, INT_APOS, INT_COLON, INT_CR, INT_EQ, INT_EXCL, INT_f, INT_F, INT_GT, INT_HYPHEN, INT_LBRACKET, INT_LF, INT_LT, INT_NULL, INT_QMARK, INT_QUOTE, INT_RBRACKET, INT_SLASH, INT_SPACE, INT_TAB, INT_z, MAX_UNICODE_CHAR, TOKEN_EOI`

Fields inherited from interface com.fasterxml.aalto.util.XmlConsts
`CHAR_CR, CHAR_LF, CHAR_NULL, CHAR_SPACE, STAX_DEFAULT_OUTPUT_ENCODING, STAX_DEFAULT_OUTPUT_VERSION, XML_DECL_KW_ENCODING, XML_DECL_KW_STANDALONE, XML_DECL_KW_VERSION, XML_SA_NO, XML_SA_YES, XML_V_10, XML_V_10_STR, XML_V_11, XML_V_11_STR, XML_V_UNKNOWN`

Fields inherited from interface javax.xml.stream.XMLStreamConstants
`ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT`

Constructor Summary
`ReaderScanner(ReaderConfig cfg, Reader r)`
`ReaderScanner(ReaderConfig cfg, Reader r, char[] buffer, int ptr, int last)`

Method Summary
`protected void` | `_closeSource()`
`protected void` | `_releaseBuffers()`
`protected PName` | `addPName(char[] nameBuffer, int nameLen, int hash)`
`protected int` | `checkInTreeIndentation(char c)` Note: consequtive white space is only considered indentation, if the following token seems like a tag (start/end).
`protected int` | `checkPrologIndentation(char c)`
`protected void` | `finishCData()`
`protected void` | `finishCharacters()`
`protected void` | `finishCoalescedCData()`
`protected void` | `finishCoalescedCharacters()`
`protected void` | `finishCoalescedText()` Method that gets called after a primary text segment (of type CHARACTERS or CDATA, not applicable to SPACE) has been read in text buffer.
`protected void` | `finishComment()`
`protected void` | `finishDTD(boolean copyContents)`
`protected void` | `finishPI()`
`protected void` | `finishSpace()`
`int` | `getCurrentColumnNr()`
`int` | `getCurrentLineNr()`
`org.codehaus.stax2.XMLStreamLocation2` | `getCurrentLocation()`
`protected int` | `handleCharEntity()`
`protected int` | `handleCommentOrCdataStart()`
`protected int` | `handleEndElement()`
`protected int` | `handleEntityInText(boolean inAttr)`
`protected int` | `handlePIStart()`
`protected int` | `handlePrologDeclStart(boolean isProlog)`
`protected int` | `handleStartElement(char c)`
`protected boolean` | `loadAndRetain(int nrOfChars)`
`protected boolean` | `loadMore()`
`protected char` | `loadOne()`
`protected char` | `loadOne(int type)`
`protected void` | `markLF()`
`protected void` | `markLF(int offset)`
`int` | `nextFromProlog(boolean isProlog)`
`int` | `nextFromTree()`
`protected PName` | `parsePName(char c)`
`protected String` | `parsePublicId(char quoteChar)`
`protected String` | `parseSystemId(char quoteChar)`
`protected void` | `skipCData()`
`protected boolean` | `skipCharacters()`
`protected boolean` | `skipCoalescedText()` Method that gets called after a primary text segment (of type CHARACTERS or CDATA, not applicable to SPACE) has been skipped.
`protected void` | `skipComment()`
`protected char` | `skipInternalWs(boolean reqd, String msg)`
`protected void` | `skipPI()`
`protected void` | `skipSpace()`

Methods inherited from class com.fasterxml.aalto.in.XmlScanner
`bindName, bindNs, checkImmutableBinding, close, decodeAttrBinaryValue, decodeAttrValue, decodeAttrValues, decodeElements, findAttrIndex, findOrCreateBinding, finishToken, fireSaxCharacterEvents, fireSaxCommentEvent, fireSaxEndElement, fireSaxPIEvent, fireSaxSpaceEvents, fireSaxStartElement, getAttrCollector, getAttrCount, getAttrLocalName, getAttrNsURI, getAttrPrefix, getAttrPrefixedName, getAttrQName, getAttrType, getAttrValue, getAttrValue, getConfig, getDepth, getDTDPublicId, getDTDSystemId, getEndLocation, getInputPublicId, getInputSystemId, getName, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getNonTransientNamespaceContext, getNsCount, getPrefix, getPrefixes, getQName, getStartLocation, getText, getText, getTextCharacters, getTextCharacters, getTextLength, hasEmptyStack, isAttrSpecified, isEmptyTag, isTextWhitespace, loadMoreGuaranteed, loadMoreGuaranteed, reportDoubleHyphenInComments, reportDuplicateNsDecl, reportEntityOverflow, reportEofInName, reportIllegalCDataEnd, reportIllegalNsDecl, reportIllegalNsDecl, reportInputProblem, reportInvalidNameChar, reportInvalidNsIndex, reportInvalidXmlChar, reportMissingPISpace, reportMultipleColonsInName, reportPrologProblem, reportPrologUnexpChar, reportTreeUnexpChar, reportUnboundPrefix, reportUnexpandedEntityInAttr, reportUnexpectedEndTag, resetForDecoding, skipToken, throwInvalidSpace, throwInvalidXmlChar, throwNullChar, throwUnexpectedChar, verifyXmlChar`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _in

    protected Reader _in

  Underlying InputStream to use for reading content.

### _inputBuffer

    protected char[] _inputBuffer

### _inputPtr

    protected int _inputPtr

### _inputEnd

    protected int _inputEnd

### mTmpChar

    protected int mTmpChar

  Storage location for a single character that can not be pushed back (for example, multi-byte char)

### _symbols

    protected final CharBasedPNameTable _symbols

  For now, symbol table contains prefixed names. In future it is possible that they may be split into prefixes and local names?

### mPastChars

    protected int mPastChars

  Number of bytes that were read and processed before the contents of the current buffer; used for calculating absolute offsets.

### mRowStartOffset

    protected int mRowStartOffset

  Offset used to calculate the column value given current input buffer pointer. May be negative, if the first character of the row was contained within an earlier buffer.

Constructor Detail

### ReaderScanner

    public ReaderScanner(ReaderConfig cfg,
                         Reader r,
                         char[] buffer,
                         int ptr,
                         int last)

### ReaderScanner

    public ReaderScanner(ReaderConfig cfg,
                         Reader r)

Method Detail

### _releaseBuffers

    protected void _releaseBuffers()

  Overrides:
    `_releaseBuffers` in class `XmlScanner`

### _closeSource

    protected void _closeSource()
                         throws IOException

  Specified by:
    `_closeSource` in class `XmlScanner`
  Throws:
    `IOException`

### nextFromProlog

    public final int nextFromProlog(boolean isProlog)
                             throws XMLStreamException

  Specified by:
    `nextFromProlog` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### nextFromTree

    public final int nextFromTree()
                           throws XMLStreamException

  Specified by:
    `nextFromTree` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### handlePrologDeclStart

    protected final int handlePrologDeclStart(boolean isProlog)
                                       throws XMLStreamException

  Throws:
    `XMLStreamException`

### handleCommentOrCdataStart

    protected final int handleCommentOrCdataStart()
                                           throws XMLStreamException

  Throws:
    `XMLStreamException`

### handlePIStart

    protected final int handlePIStart()
                               throws XMLStreamException

  Throws:
    `XMLStreamException`

### handleCharEntity

    protected final int handleCharEntity()
                                  throws XMLStreamException

  Returns:
    Code point for the entity that expands to a valid XML content character.
  Throws:
    `XMLStreamException`

### handleStartElement

    protected final int handleStartElement(char c)
                                    throws XMLStreamException

  Throws:
    `XMLStreamException`

### handleEndElement

    protected final int handleEndElement()
                                  throws XMLStreamException

  Throws:
    `XMLStreamException`

### handleEntityInText

    protected final int handleEntityInText(boolean inAttr)
                                    throws XMLStreamException

  Throws:
    `XMLStreamException`

### finishComment

    protected final void finishComment()
                                throws XMLStreamException

  Specified by:
    `finishComment` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishPI

    protected final void finishPI()
                           throws XMLStreamException

  Specified by:
    `finishPI` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishDTD

    protected final void finishDTD(boolean copyContents)
                            throws XMLStreamException

  Specified by:
    `finishDTD` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishCData

    protected final void finishCData()
                              throws XMLStreamException

  Specified by:
    `finishCData` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishCharacters

    protected final void finishCharacters()
                                   throws XMLStreamException

  Specified by:
    `finishCharacters` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishSpace

    protected final void finishSpace()
                              throws XMLStreamException

  Specified by:
    `finishSpace` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### finishCoalescedText

    protected final void finishCoalescedText()
                                      throws XMLStreamException

  Method that gets called after a primary text segment (of type CHARACTERS or CDATA, not applicable to SPACE) has been read in text buffer. Method has to see if the following event would be textual as well, and if so, read it (and any other following textual segments).

  Throws:
    `XMLStreamException`

### finishCoalescedCData

    protected final void finishCoalescedCData()
                                       throws XMLStreamException

  Throws:
    `XMLStreamException`

### finishCoalescedCharacters

    protected final void finishCoalescedCharacters()
                                            throws XMLStreamException

  Throws:
    `XMLStreamException`

### skipCoalescedText

    protected final boolean skipCoalescedText()
                                       throws XMLStreamException

  Method that gets called after a primary text segment (of type CHARACTERS or CDATA, not applicable to SPACE) has been skipped. Method has to see if the following event would be textual as well, and if so, skip it (and any other following textual segments).

  Specified by:
    `skipCoalescedText` in class `XmlScanner`
  Returns:
    True if we encountered an unexpandable entity
  Throws:
    `XMLStreamException`

### skipComment

    protected final void skipComment()
                              throws XMLStreamException

  Specified by:
    `skipComment` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### skipPI

    protected final void skipPI()
                         throws XMLStreamException

  Specified by:
    `skipPI` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### skipCharacters

    protected final boolean skipCharacters()
                                    throws XMLStreamException

  Specified by:
    `skipCharacters` in class `XmlScanner`
  Returns:
    True, if an unexpanded entity was encountered (and is now pending)
  Throws:
    `XMLStreamException`

### skipCData

    protected final void skipCData()
                            throws XMLStreamException

  Specified by:
    `skipCData` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### skipSpace

    protected final void skipSpace()
                            throws XMLStreamException

  Specified by:
    `skipSpace` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### skipInternalWs

    protected char skipInternalWs(boolean reqd,
                                  String msg)
                           throws XMLStreamException

  Returns:
    First byte following skipped white space
  Throws:
    `XMLStreamException`

### checkInTreeIndentation

    protected final int checkInTreeIndentation(char c)
                                        throws XMLStreamException

  Note: consequtive white space is only considered indentation, if the following token seems like a tag (start/end). This so that if a CDATA section follows, it can be coalesced in coalescing mode. Although we could check if coalescing mode is enabled, this should seldom have significant effect either way, so it removes one possible source of problems in coalescing mode.

  Returns:
    -1, if indentation was handled; offset in the output buffer, if not
  Throws:
    `XMLStreamException`

### checkPrologIndentation

    protected final int checkPrologIndentation(char c)
                                        throws XMLStreamException

  Returns:
    -1, if indentation was handled; offset in the output buffer, if not
  Throws:
    `XMLStreamException`

### parsePName

    protected PName parsePName(char c)
                        throws XMLStreamException

  Throws:
    `XMLStreamException`

### addPName

    protected final PName addPName(char[] nameBuffer,
                                   int nameLen,
                                   int hash)
                            throws XMLStreamException

  Throws:
    `XMLStreamException`

### parsePublicId

    protected String parsePublicId(char quoteChar)
                            throws XMLStreamException

  Throws:
    `XMLStreamException`

### parseSystemId

    protected String parseSystemId(char quoteChar)
                            throws XMLStreamException

  Throws:
    `XMLStreamException`

### getCurrentLocation

    public org.codehaus.stax2.XMLStreamLocation2 getCurrentLocation()

  Specified by:
    `getCurrentLocation` in class `XmlScanner`
  Returns:
    Current input location

### getCurrentLineNr

    public int getCurrentLineNr()

  Specified by:
    `getCurrentLineNr` in class `XmlScanner`

### getCurrentColumnNr

    public int getCurrentColumnNr()

  Specified by:
    `getCurrentColumnNr` in class `XmlScanner`

### markLF

    protected final void markLF(int offset)

### markLF

    protected final void markLF()

### loadMore

    protected final boolean loadMore()
                              throws XMLStreamException

  Specified by:
    `loadMore` in class `XmlScanner`
  Throws:
    `XMLStreamException`

### loadOne

    protected final char loadOne()
                          throws XMLStreamException

  Throws:
    `XMLStreamException`

### loadOne

    protected final char loadOne(int type)
                          throws XMLStreamException

  Throws:
    `XMLStreamException`

### loadAndRetain

    protected final boolean loadAndRetain(int nrOfChars)
                                   throws XMLStreamException

  Throws:
    `XMLStreamException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 Fasterxml.com. All Rights Reserved.