Top Fields Constructors Methods
com.fasterxml.aalto.async

public abstract Class AsyncByteScanner

extends ByteBasedScanner
implements AsyncInputFeeder
Class Inheritance
All Implemented Interfaces
com.fasterxml.aalto.AsyncInputFeeder
Known Direct Subclasses
com.fasterxml.aalto.async.AsyncByteArrayScanner, com.fasterxml.aalto.async.AsyncByteBufferScanner
Imports
java.io.IOException, javax.xml.stream.XMLStreamException, com.fasterxml.aalto.AsyncInputFeeder, .AsyncXMLStreamReader, com.fasterxml.aalto.impl.ErrorConsts, com.fasterxml.aalto.in.ByteBasedPNameTable, .ByteBasedScanner, .PName, .ReaderConfig, com.fasterxml.aalto.util.CharsetNames, .DataUtil, .XmlCharTypes

Field Summary

Modifier and TypeField and Description
protected XmlCharTypes
_charTypes

This is a simple container object that is used to access the decoding tables for characters.

protected int
_currQuad

Bytes parsed for the current, incomplete, quad

protected int
_currQuadBytes

Number of bytes pending/buffered, stored in _currQuad

protected boolean
protected boolean
protected PName
protected int
_elemAttrPtr

Pointer for the next character of currently being parsed value within attribute value buffer

protected byte
protected int
_elemNsPtr

Pointer for the next character of currently being parsed namespace URI for the current namespace declaration

protected boolean
_endOfInput

Flag that is sent when calling application indicates that there will be no more input to parse.

protected int
_entityValue

Entity value accumulated so far

protected boolean
_inDtdDeclaration

Flag that indicates whether we are inside a declaration during parsing of internal DTD subset.

protected int
_nextEvent

Due to asynchronous nature of parsing, we may know what event we are trying to parse, even if it's not yet complete.

protected int
_pendingInput

There are some multi-byte combinations that must be handled as a unit: CR+LF linefeeds, multi-byte UTF-8 characters, and multi-character end markers for comments and PIs.

protected int[]
_quadBuffer

This buffer is used for name parsing.

protected int
_quadCount

Number of complete quads parsed for current name (quads themselves are stored in _quadBuffer).

protected int
_state

In addition to the event type, there is need for additional state information

protected int
_surroundingEvent

For token/state combinations that are 'shared' between events (or embedded in them), this is where the surrounding event state is retained.

protected ByteBasedPNameTable
_symbols

For now, symbol table contains prefixed names.

protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
STATE_DEFAULT

Default starting state for many events/contexts -- nothing has been seen so far, no event incomplete.

protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
STATE_PROLOG_INITIAL

State in which a less-than sign has been seen

protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
Inherited from com.fasterxml.aalto.in.ByteBasedScanner:
_inputEnd_inputPtr_tmpCharBYTE_aBYTE_ABYTE_AMPBYTE_APOSBYTE_CBYTE_CRBYTE_DBYTE_EQBYTE_EXCLBYTE_gBYTE_GTBYTE_HASHBYTE_HYPHENBYTE_lBYTE_LBRACKETBYTE_LFBYTE_LTBYTE_mBYTE_NULLBYTE_oBYTE_pBYTE_PBYTE_qBYTE_QMARKBYTE_QUOTBYTE_RBRACKETBYTE_sBYTE_SBYTE_SEMICOLONBYTE_SLASHBYTE_SPACEBYTE_tBYTE_TBYTE_TABBYTE_uBYTE_x

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
_activateEncoding()

Initialization method to call when encoding has been definitely figured out, from XML declarations, or, from lack of one (using defaults).

protected void
_closeSource()

Implements abstract com.fasterxml.aalto.in.ByteBasedScanner._closeSource.

Since the async scanner has no access to whatever passes content, there is no input source in same sense as with blocking scanner; and there is nothing to close.
protected abstract byte
protected final PName
_findXmlDeclName(int lastQuad, int lastByteCount)

protected abstract byte
private final PName
private final PName
protected abstract byte
protected void
protected int
_startDocumentNoXmlDecl()

Helper method called when it is determined that the document does NOT start with an xml declaration.

protected final PName
addPName(ByteBasedPNameTable symbols, int hash, int[] quads, int qlen, int lastQuadBytes)

protected abstract boolean
protected void
protected int
decodeCharForError(byte b)

Implements abstract com.fasterxml.aalto.in.ByteBasedScanner.decodeCharForError.

Method called by methods when encountering a byte that can not be part of a valid character in the current context.
public void
endOfInput()

Implements com.fasterxml.aalto.AsyncInputFeeder.endOfInput.

Method that should be called after last chunk of data to parse has been fed.
protected final PName
findPName(int
Word with last 0 to 3 bytes of the PName; not included in the quad array
lastQuad
,
int
Number of bytes contained in lastQuad; 0 to 3.
lastByteCount
)

Method called to process a sequence of bytes that is likely to be a PName.

protected void
protected abstract void
protected void
protected void
finishDTD(boolean copyContents)

Implements abstract com.fasterxml.aalto.in.XmlScanner.finishDTD.

protected void
protected void
protected final void
finishToken()

Implements abstract com.fasterxml.aalto.in.XmlScanner.finishToken.

This method is called to ensure that the current token/event has been completely parsed, such that we have all the data needed to return it (textual content, PI data, comment text etc)
protected abstract boolean
protected abstract int
private int
protected abstract boolean
protected abstract boolean
protected abstract boolean
protected abstract int
private final int
handlePrologDeclStart(boolean isProlog)

protected abstract int
protected abstract int
private int

Returns:

Completed token (START_DOCUMENT), if fully parsed; incomplete (EVENT_INCOMPLETE) otherwise
handleXmlDeclaration
()

Method called to complete parsing of XML declaration, once it has been reliably detected.

protected boolean
public final int
private final boolean
parseDtdId(char[] outputBuffer, int outputPtr, boolean system)

protected abstract PName
parseNewName(byte b)

protected abstract PName
protected boolean

Returns:

True if we managed to parse the whole pseudo-attribute
parseXmlDeclAttr
(char[] outputBuffer, int outputPtr)

Method called to try to parse an XML pseudo-attribute value.

protected void
reportInvalidOther(int mask, int ptr)

protected void
protected abstract boolean

Returns:

True if the whole characters segment was succesfully skipped; false if not
skipCharacters
()

Implements abstract com.fasterxml.aalto.in.XmlScanner.skipCharacters.

protected void
protected void
protected void
protected abstract int

Returns:

Event type detected; either CHARACTERS, if at least one full character was decoded (and can be returned), EVENT_INCOMPLETE if not (part of a multi-byte character split across input buffer boundary)
startCharacters
(byte b)

Method called to initialize state for CHARACTERS event, after just a single byte has been seen.

private final Boolean

Returns:

null if parsing is inconclusive (may or may not be XML declaration); Boolean.TRUE if complete XML declaration, and Boolean.FALSE if something else
startXmlDeclaration
()

Method that deals with recognizing XML declaration, but not with parsing its contents.

protected int
protected boolean

Returns:

true if the character is valid for use in the Public ID of an XML doctype declaration
validPublicIdChar
(int
A character
c
)

Checks that a character for a PublicId

protected void
verifyAndAppendEntityCharacter(int charFromEntity)

Method called to verify validity of given character (from entity) and append it to the text buffer

protected void
protected void
protected void
protected void
protected void
Inherited from com.fasterxml.aalto.in.ByteBasedScanner:
addUTFPNamegetCurrentColumnNrgetCurrentLocationgetEndingByteOffsetgetEndingCharOffsetgetStartingByteOffsetgetStartingCharOffsetmarkLFmarkLFreportInvalidInitialreportInvalidOthersetStartLocation