Top Description Fields Constructors Methods
com.fasterxml.aalto.async

public Class AsyncByteArrayScanner

extends AsyncByteScanner
implements AsyncByteArrayFeeder
Class Inheritance
All Implemented Interfaces
com.fasterxml.aalto.AsyncByteArrayFeeder, com.fasterxml.aalto.AsyncInputFeeder
Imports
javax.xml.stream.XMLStreamException, com.fasterxml.aalto.AsyncByteArrayFeeder, com.fasterxml.aalto.in.*, com.fasterxml.aalto.util.DataUtil, .XmlCharTypes

This is the base class for asynchronous (non-blocking) XML scanners. Due to basic complexity of async approach, character-based doesn't make much sense, so only byte-based input is supported.

Field Summary

Modifier and TypeField and Description
protected byte[]
_inputBuffer

This buffer is actually provided by caller

protected int
_origBufferLen

In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained.

Inherited from com.fasterxml.aalto.async.AsyncByteScanner:
_charTypes_currQuad_currQuadBytes_elemAllNsBound_elemAttrCount_elemAttrName_elemAttrPtr_elemAttrQuote_elemNsPtr_endOfInput_entityValue_inDtdDeclaration_nextEvent_pendingInput_quadBuffer_quadCount_state_surroundingEvent_symbolsEVENT_INCOMPLETEPENDING_STATE_ATTR_VALUE_AMPPENDING_STATE_ATTR_VALUE_AMP_HASHPENDING_STATE_ATTR_VALUE_AMP_HASH_XPENDING_STATE_ATTR_VALUE_DEC_DIGITPENDING_STATE_ATTR_VALUE_ENTITY_NAMEPENDING_STATE_ATTR_VALUE_HEX_DIGITPENDING_STATE_CDATA_BRACKET1PENDING_STATE_CDATA_BRACKET2PENDING_STATE_COMMENT_HYPHEN1PENDING_STATE_COMMENT_HYPHEN2PENDING_STATE_CRPENDING_STATE_ENT_IN_DEC_DIGITPENDING_STATE_ENT_IN_HEX_DIGITPENDING_STATE_ENT_SEEN_HASHPENDING_STATE_ENT_SEEN_HASH_XPENDING_STATE_PI_QMARKPENDING_STATE_TEXT_AMPPENDING_STATE_TEXT_AMP_HASHPENDING_STATE_TEXT_BRACKET1PENDING_STATE_TEXT_BRACKET2PENDING_STATE_TEXT_DEC_ENTITYPENDING_STATE_TEXT_HEX_ENTITYPENDING_STATE_TEXT_IN_ENTITYPENDING_STATE_XMLDECL_LTPENDING_STATE_XMLDECL_LTQPENDING_STATE_XMLDECL_TARGETSTATE_CDATA_CSTATE_CDATA_CDSTATE_CDATA_CDASTATE_CDATA_CDATSTATE_CDATA_CDATASTATE_CDATA_CONTENTSTATE_COMMENT_CONTENTSTATE_COMMENT_HYPHENSTATE_COMMENT_HYPHEN2STATE_DEFAULTSTATE_DTD_AFTER_DOCTYPESTATE_DTD_AFTER_PUBLICSTATE_DTD_AFTER_PUBLIC_IDSTATE_DTD_AFTER_ROOT_NAMESTATE_DTD_AFTER_SYSTEMSTATE_DTD_AFTER_SYSTEM_IDSTATE_DTD_BEFORE_IDSSTATE_DTD_BEFORE_PUBLIC_IDSTATE_DTD_BEFORE_ROOT_NAMESTATE_DTD_BEFORE_SYSTEM_IDSTATE_DTD_DOCTYPESTATE_DTD_EXPECT_CLOSING_GTSTATE_DTD_INT_SUBSETSTATE_DTD_PUBLIC_IDSTATE_DTD_PUBLIC_OR_SYSTEMSTATE_DTD_ROOT_NAMESTATE_DTD_SYSTEM_IDSTATE_EE_NEED_GTSTATE_PI_AFTER_TARGETSTATE_PI_AFTER_TARGET_QMARKSTATE_PI_AFTER_TARGET_WSSTATE_PI_IN_DATASTATE_PI_IN_TARGETSTATE_PROLOG_DECLSTATE_PROLOG_INITIALSTATE_PROLOG_SEEN_LTSTATE_SE_ATTR_NAMESTATE_SE_ATTR_VALUE_NORMALSTATE_SE_ATTR_VALUE_NSDECLSTATE_SE_ELEM_NAMESTATE_SE_SEEN_SLASHSTATE_SE_SPACE_OR_ATTRNAMESTATE_SE_SPACE_OR_ATTRVALUESTATE_SE_SPACE_OR_ENDSTATE_SE_SPACE_OR_EQSTATE_TEXT_AMPSTATE_TEXT_AMP_NAMESTATE_TREE_NAMED_ENTITY_STARTSTATE_TREE_NUMERIC_ENTITY_STARTSTATE_TREE_SEEN_AMPSTATE_TREE_SEEN_EXCLSTATE_TREE_SEEN_LTSTATE_TREE_SEEN_SLASHSTATE_XMLDECL_AFTER_ENCODINGSTATE_XMLDECL_AFTER_ENCODING_VALUESTATE_XMLDECL_AFTER_STANDALONESTATE_XMLDECL_AFTER_STANDALONE_VALUESTATE_XMLDECL_AFTER_VERSIONSTATE_XMLDECL_AFTER_VERSION_VALUESTATE_XMLDECL_AFTER_XMLSTATE_XMLDECL_BEFORE_ENCODINGSTATE_XMLDECL_BEFORE_STANDALONESTATE_XMLDECL_BEFORE_VERSIONSTATE_XMLDECL_ENCODINGSTATE_XMLDECL_ENCODING_EQSTATE_XMLDECL_ENCODING_VALUESTATE_XMLDECL_ENDQSTATE_XMLDECL_STANDALONESTATE_XMLDECL_STANDALONE_EQSTATE_XMLDECL_STANDALONE_VALUESTATE_XMLDECL_VERSIONSTATE_XMLDECL_VERSION_EQSTATE_XMLDECL_VERSION_VALUE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final byte
protected final byte
protected final byte
protected boolean

Returns:

True, if was able to skip through the space and find a non-space byte; false if reached end-of-buffer
asyncSkipSpace
()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.asyncSkipSpace.

Method to skip whatever space can be skipped.
protected final boolean

Returns:

True if entity was decoded (and value assigned to _entityValue; false otherwise
decodeDecEntity
()

protected final int

Returns:

Character of the expanded pre-defined general entity (if name matches one); zero if not.
decodeGeneralEntity
(PName entityName)

Method that verifies that given named entity is followed by a semi-colon (meaning next byte must be available for reading); and if so, whether it is one of pre-defined general entities.

protected final boolean

Returns:

True if entity was decoded (and value assigned to _entityValue; false otherwise
decodeHexEntity
()

protected final int
decodeUtf8_2(int c)

Note

caller must guarantee enough data is available before calling the method

protected final int
decodeUtf8_3(int c1)

Note

caller must guarantee enough data is available before calling the method

protected final int
decodeUtf8_3(int c1, int c2, int c3)

protected final int
decodeUtf8_4(int c)

protected final int

Returns:

Character value minus 0x10000; this so that caller can readily expand it to actual surrogates
decodeUtf8_4
(int c1, int c2, int c3, int c4)

public void
feedInput(byte[]
Byte array that containts data to feed: caller must ensure data remains stable until it is fully processed (which is true when needMoreInput returns true)
buf
,
int
Offset within array where input data to process starts
start
,
int
Length of input data within array to process.
len
)

Implements com.fasterxml.aalto.AsyncByteArrayFeeder.feedInput.

Method that can be called to feed more data, if (and only if) needMoreInput returns true.
protected final void
finishCharacters()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.finishCharacters.

This method only gets called in non-coalescing mode; and if so, needs to parse as many characters of the current text segment from the current input block as possible.
protected final int
finishCharactersCoalescing()

Todo

Method not yet implemented

private int
finishStartElement(boolean emptyTag)

Method called to wrap up settings when the whole start (or empty) element has been parsed.

private final boolean

Returns:

True, if split character was completely handled; false if not
handleAndAppendPending
()

Method called to handle split multi-byte character, by decoding it and appending to the text buffer, if possible.

protected boolean

Returns:

True, if the whole value was read; false if only part (due to buffer ending)
handleAttrValue
()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleAttrValue.

private final boolean

Returns:

True if the partial information was succesfully handled; false if not
handleAttrValuePending
()

private final int
private int
protected final int

Returns:

EVENT_INCOMPLETE, if there's not enough input to handle pending char, CDATA, if we handled complete "]]>" end marker, or 0 to indicate something else was succesfully handled.
handleCDataPending
()

private int
protected final int
protected int

Returns:

EVENT_INCOMPLETE, if there's not enough input to handle pending char, COMMENT, if we handled complete "-->" end marker, or 0 to indicate something else was succesfully handled.
handleCommentPending
()

private final int
handleDecEntityInAttribute(boolean starting)

protected int
protected final boolean
private int
handleEndElement()

This method is "slow" version of above, used when name of the end element can split input buffer boundary

private int
protected int

Returns:

Value of expanded character entity, if processed (which must be 1 or above); 0 for general entity, or -1 for "not enough input"
handleEntityInAttributeValue
()

Method called to handle entity encountered inside attribute value.

protected int

Returns:

Expanded (character) entity, if positive number; 0 if incomplete.
handleEntityInCharacters
()

Method called to handle entity encountered inside CHARACTERS segment, when trying to complete a non-coalescing text segment.

protected int

Returns:

Type of event to return
handleEntityStartingToken
()

Method called when a new token (within tree) starts with an entity.

private final int
handleHexEntityInAttribute(boolean starting)

protected int
protected int
handleNamedEntityStartingToken()

Method called when we see an entity that is starting a new token, and part of its name has been decoded (but not all)

protected boolean
private final boolean

Returns:

True if the partial information was succesfully handled; false if not
handleNsValuePending
()

protected int
handleNumericEntityStartingToken()

Method called to handle cases where we find something other than a character entity (or one of 4 pre-defined general entities that act like character entities)

protected final boolean

Returns:

True if the linefeed was succesfully processed (had enough input data to do that); or false if there is no data available to check this
handlePartialCR
()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handlePartialCR.

Method called when there is a pending \r (from past buffer), and we need to see
protected int
protected int

Returns:

EVENT_INCOMPLETE, if there's not enough input to handle pending char, PROCESSING_INSTRUCTION, if we handled complete "?>" end marker, or 0 to indicate something else was succesfully handled.
handlePIPending
()

protected int
protected int
handleStartElementStart(byte b)

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleStartElementStart.

Method called when '<' and (what appears to be) a name start character have been seen.
private void
initAttribute(byte quoteChar)

private void
public final boolean
needMoreInput()

Implements com.fasterxml.aalto.AsyncInputFeeder.needMoreInput.

Method called to check whether it is ok to feed more data: parser returns true if it has no more content to parse (and it is ok to feed more); otherwise false (and no data should yet be fed).
public int
protected final int
protected int
protected final PName
protected final PName
protected final PName
protected int
protected final PName
parsePName()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.parsePName.

This method can (for now?) be shared between all Ascii-based encodings, since it only does coarse validity checking -- real checks are done in different method.
protected boolean

Returns:

True, if skipping ending with an unexpanded entity; false if not
skipCharacters
()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.skipCharacters.

Method that will be called to skip all possible characters from the input buffer, but without blocking.
protected boolean
skipCoalescedText()

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

Coalescing mode is (and will) not be implemented for non-blocking parsers, so this method should never get called.
private int

Returns:

Expanded (character) entity, if positive number; 0 if incomplete.
skipEntityInCharacters
()

Method called to handle entity encountered inside CHARACTERS segment, when trying to complete a non-coalescing text segment.

private final boolean
protected final void
skipUtf8_2(int c)

protected final int
startCharacters(byte b)

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.startCharacters.

Method called to initialize state for CHARACTERS event, after just a single byte has been seen.
protected int
startCharactersPending()

This method gets called, if the first character of a CHARACTERS event could not be fully read (multi-byte, split over buffer boundary).

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from com.fasterxml.aalto.async.AsyncByteScanner:
_activateEncoding_closeSource_findXmlDeclName_releaseBuffers_startDocumentNoXmlDecladdPNamecheckPITargetNamedecodeCharForErrorendOfInputfindPNamefinishCDatafinishCommentfinishDTDfinishPIfinishSpacefinishTokenloadMorenextFromPrologparseXmlDeclAttrreportInvalidOtherskipCDataskipCommentskipPIskipSpacethrowInternalvalidPublicIdCharverifyAndAppendEntityCharacterverifyAndSetPublicIdverifyAndSetSystemIdverifyAndSetXmlEncodingverifyAndSetXmlStandaloneverifyAndSetXmlVersion

Field Detail

_inputBufferback to summary
protected byte[] _inputBuffer

This buffer is actually provided by caller

_origBufferLenback to summary
protected int _origBufferLen

In addition to current buffer pointer, and end pointer, we will also need to know number of bytes originally contained. This is needed to correctly update location information when the block has been completed.

Constructor Detail

AsyncByteArrayScannerback to summary
public AsyncByteArrayScanner(ReaderConfig cfg)

Method Detail

_currentByteback to summary
protected final byte _currentByte() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner._currentByte.

Annotations
@Override
_nextByteback to summary
protected final byte _nextByte() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner._nextByte.

Annotations
@Override
_prevByteback to summary
protected final byte _prevByte() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner._prevByte.

Annotations
@Override
asyncSkipSpaceback to summary
protected boolean asyncSkipSpace() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.asyncSkipSpace.

Method to skip whatever space can be skipped.

Note

if available content ends with a CR, method will set _pendingInput to PENDING_STATE_CR.

Returns:boolean

True, if was able to skip through the space and find a non-space byte; false if reached end-of-buffer

Annotations
@Override
decodeDecEntityback to summary
protected final boolean decodeDecEntity() throws XMLStreamException
Returns:boolean

True if entity was decoded (and value assigned to _entityValue; false otherwise

decodeGeneralEntityback to summary
protected final int decodeGeneralEntity(PName entityName) throws XMLStreamException

Method that verifies that given named entity is followed by a semi-colon (meaning next byte must be available for reading); and if so, whether it is one of pre-defined general entities.

Returns:int

Character of the expanded pre-defined general entity (if name matches one); zero if not.

decodeHexEntityback to summary
protected final boolean decodeHexEntity() throws XMLStreamException
Returns:boolean

True if entity was decoded (and value assigned to _entityValue; false otherwise

decodeUtf8_2back to summary
protected final int decodeUtf8_2(int c) throws XMLStreamException

Note

caller must guarantee enough data is available before calling the method

decodeUtf8_3back to summary
protected final int decodeUtf8_3(int c1) throws XMLStreamException

Note

caller must guarantee enough data is available before calling the method

decodeUtf8_3back to summary
protected final int decodeUtf8_3(int c1, int c2, int c3) throws XMLStreamException
decodeUtf8_4back to summary
protected final int decodeUtf8_4(int c) throws XMLStreamException
decodeUtf8_4back to summary
protected final int decodeUtf8_4(int c1, int c2, int c3, int c4) throws XMLStreamException
Returns:int

Character value minus 0x10000; this so that caller can readily expand it to actual surrogates

feedInputback to summary
public void feedInput(byte[] buf, int start, int len) throws XMLStreamException

Implements com.fasterxml.aalto.AsyncByteArrayFeeder.feedInput.

Doc from com.fasterxml.aalto.AsyncByteArrayFeeder.feedInput.

Method that can be called to feed more data, if (and only if) needMoreInput returns true.

Parameters
buf:byte[]

Byte array that containts data to feed: caller must ensure data remains stable until it is fully processed (which is true when needMoreInput returns true)

start:int

Offset within array where input data to process starts

len:int

Length of input data within array to process.

Annotations
@Override
Exceptions
XMLStreamException:
if the state is such that this method should not be called (has not yet consumed existing input data, or has been marked as closed)
finishCharactersback to summary
protected final void finishCharacters() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.finishCharacters.

This method only gets called in non-coalescing mode; and if so, needs to parse as many characters of the current text segment from the current input block as possible.

Annotations
@Override
finishCharactersCoalescingback to summary
protected final int finishCharactersCoalescing() throws XMLStreamException

Todo

Method not yet implemented

finishStartElementback to summary
private int finishStartElement(boolean emptyTag) throws XMLStreamException

Method called to wrap up settings when the whole start (or empty) element has been parsed.

handleAndAppendPendingback to summary
private final boolean handleAndAppendPending() throws XMLStreamException

Method called to handle split multi-byte character, by decoding it and appending to the text buffer, if possible.

Returns:boolean

True, if split character was completely handled; false if not

handleAttrValueback to summary
protected boolean handleAttrValue() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleAttrValue.

Returns:boolean

True, if the whole value was read; false if only part (due to buffer ending)

Annotations
@Override
handleAttrValuePendingback to summary
private final boolean handleAttrValuePending() throws XMLStreamException
Returns:boolean

True if the partial information was succesfully handled; false if not

handleAttrValuePendingUTF8back to summary
private final int handleAttrValuePendingUTF8() throws XMLStreamException
handleCDataback to summary
private int handleCData() throws XMLStreamException
handleCDataPendingback to summary
protected final int handleCDataPending() throws XMLStreamException
Returns:int

EVENT_INCOMPLETE, if there's not enough input to handle pending char, CDATA, if we handled complete "]]>" end marker, or 0 to indicate something else was succesfully handled.

handleCDataStartMarkerback to summary
private int handleCDataStartMarker(byte b) throws XMLStreamException
handleCommentback to summary
protected final int handleComment() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleComment.

Annotations
@Override
handleCommentPendingback to summary
protected int handleCommentPending() throws XMLStreamException
Returns:int

EVENT_INCOMPLETE, if there's not enough input to handle pending char, COMMENT, if we handled complete "-->" end marker, or 0 to indicate something else was succesfully handled.

handleDecEntityInAttributeback to summary
private final int handleDecEntityInAttribute(boolean starting) throws XMLStreamException
handleDecEntityInCharactersback to summary
protected int handleDecEntityInCharacters(int ptr) throws XMLStreamException
handleDTDInternalSubsetback to summary
protected final boolean handleDTDInternalSubset(boolean init) throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleDTDInternalSubset.

Annotations
@Override
handleEndElementback to summary
private int handleEndElement() throws XMLStreamException

This method is "slow" version of above, used when name of the end element can split input buffer boundary

handleEndElementStartback to summary
private int handleEndElementStart() throws XMLStreamException
handleEntityInAttributeValueback to summary
protected int handleEntityInAttributeValue() throws XMLStreamException

Method called to handle entity encountered inside attribute value.

Returns:int

Value of expanded character entity, if processed (which must be 1 or above); 0 for general entity, or -1 for "not enough input"

handleEntityInCharactersback to summary
protected int handleEntityInCharacters() throws XMLStreamException

Method called to handle entity encountered inside CHARACTERS segment, when trying to complete a non-coalescing text segment.

Note

unlike with generic parsing of named entities, where trailing semicolon needs to be left in place, here we should just process it right away.

Returns:int

Expanded (character) entity, if positive number; 0 if incomplete.

handleEntityStartingTokenback to summary
protected int handleEntityStartingToken() throws XMLStreamException

Method called when a new token (within tree) starts with an entity.

Returns:int

Type of event to return

handleHexEntityInAttributeback to summary
private final int handleHexEntityInAttribute(boolean starting) throws XMLStreamException
handleHexEntityInCharactersback to summary
protected int handleHexEntityInCharacters(int ptr) throws XMLStreamException
handleNamedEntityStartingTokenback to summary
protected int handleNamedEntityStartingToken() throws XMLStreamException

Method called when we see an entity that is starting a new token, and part of its name has been decoded (but not all)

handleNsDeclback to summary
protected boolean handleNsDecl() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleNsDecl.

Annotations
@Override
handleNsValuePendingback to summary
private final boolean handleNsValuePending() throws XMLStreamException
Returns:boolean

True if the partial information was succesfully handled; false if not

handleNumericEntityStartingTokenback to summary
protected int handleNumericEntityStartingToken() throws XMLStreamException

Method called to handle cases where we find something other than a character entity (or one of 4 pre-defined general entities that act like character entities)

handlePartialCRback to summary
protected final boolean handlePartialCR()

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handlePartialCR.

Method called when there is a pending \r (from past buffer), and we need to see

Returns:boolean

True if the linefeed was succesfully processed (had enough input data to do that); or false if there is no data available to check this

Annotations
@Override
handlePIback to summary
protected int handlePI() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handlePI.

Annotations
@Override
handlePIPendingback to summary
protected int handlePIPending() throws XMLStreamException
Returns:int

EVENT_INCOMPLETE, if there's not enough input to handle pending char, PROCESSING_INSTRUCTION, if we handled complete "?>" end marker, or 0 to indicate something else was succesfully handled.

handleStartElementback to summary
protected int handleStartElement() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleStartElement.

Annotations
@Override
handleStartElementStartback to summary
protected int handleStartElementStart(byte b) throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.handleStartElementStart.

Method called when '<' and (what appears to be) a name start character have been seen.

Annotations
@Override
initAttributeback to summary
private void initAttribute(byte quoteChar)
initStartElementback to summary
private void initStartElement(PName elemName)
needMoreInputback to summary
public final boolean needMoreInput()

Implements com.fasterxml.aalto.AsyncInputFeeder.needMoreInput.

Doc from com.fasterxml.aalto.AsyncInputFeeder.needMoreInput.

Method called to check whether it is ok to feed more data: parser returns true if it has no more content to parse (and it is ok to feed more); otherwise false (and no data should yet be fed).

Annotations
@Override
nextFromTreeback to summary
public int nextFromTree() throws XMLStreamException

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

Annotations
@Override
parseCDataContentsback to summary
protected final int parseCDataContents() throws XMLStreamException
parseCommentContentsback to summary
protected int parseCommentContents() throws XMLStreamException
parseEntityNameback to summary
protected final PName parseEntityName() throws XMLStreamException
parseNewEntityNameback to summary
protected final PName parseNewEntityName(byte b) throws XMLStreamException
parseNewNameback to summary
protected final PName parseNewName(byte b) throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.parseNewName.

Annotations
@Override
parsePIDataback to summary
protected int parsePIData() throws XMLStreamException
parsePNameback to summary
protected final PName parsePName() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.parsePName.

This method can (for now?) be shared between all Ascii-based encodings, since it only does coarse validity checking -- real checks are done in different method.

Some notes about assumption implementation makes:

  • Well-formed xml content can not end with a name: as such, end-of-input is an error and we can throw an exception
Annotations
@Override
skipCharactersback to summary
protected boolean skipCharacters() throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.skipCharacters.

Method that will be called to skip all possible characters from the input buffer, but without blocking. Partial characters are not to be handled (not pending input is to be added).

Returns:boolean

True, if skipping ending with an unexpanded entity; false if not

Annotations
@Override
skipCoalescedTextback to summary
protected boolean skipCoalescedText() throws XMLStreamException

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

Coalescing mode is (and will) not be implemented for non-blocking parsers, so this method should never get called.

Returns:boolean

Doc from com.fasterxml.aalto.in.XmlScanner.skipCoalescedText.

True, if an unexpanded entity was encountered (and is now pending)

Annotations
@Override
skipEntityInCharactersback to summary
private int skipEntityInCharacters() throws XMLStreamException

Method called to handle entity encountered inside CHARACTERS segment, when trying to complete a non-coalescing text segment.

Returns:int

Expanded (character) entity, if positive number; 0 if incomplete.

skipPendingback to summary
private final boolean skipPending() throws XMLStreamException
skipUtf8_2back to summary
protected final void skipUtf8_2(int c) throws XMLStreamException
startCharactersback to summary
protected final int startCharacters(byte b) throws XMLStreamException

Implements abstract com.fasterxml.aalto.async.AsyncByteScanner.startCharacters.

Doc from com.fasterxml.aalto.async.AsyncByteScanner.startCharacters.

Method called to initialize state for CHARACTERS event, after just a single byte has been seen. What needs to be done next depends on whether coalescing mode is set or not: if it is not set, just a single character needs to be decoded, after which current event will be incomplete, but defined as CHARACTERS. In coalescing mode, the whole content must be read before current event can be defined. The reason for difference is that when XMLStreamReader.next() returns, no blocking can occur when calling other methods.

Returns:int

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)

Annotations
@Override
startCharactersPendingback to summary
protected int startCharactersPending() throws XMLStreamException

This method gets called, if the first character of a CHARACTERS event could not be fully read (multi-byte, split over buffer boundary). If so, there is some pending data to be handled.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override