public class AsyncByteBufferScanner extends AsyncByteScanner implements AsyncByteBufferFeeder
| Modifier and Type | Field and Description |
|---|---|
protected ByteBuffer |
_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.
|
_charTypes, _currQuad, _currQuadBytes, _elemAllNsBound, _elemAttrCount, _elemAttrName, _elemAttrPtr, _elemAttrQuote, _elemNsPtr, _endOfInput, _entityValue, _inDtdDeclaration, _nextEvent, _pendingInput, _quadBuffer, _quadCount, _state, _surroundingEvent, _symbols, EVENT_INCOMPLETE, PENDING_STATE_ATTR_VALUE_AMP, PENDING_STATE_ATTR_VALUE_AMP_HASH, PENDING_STATE_ATTR_VALUE_AMP_HASH_X, PENDING_STATE_ATTR_VALUE_DEC_DIGIT, PENDING_STATE_ATTR_VALUE_ENTITY_NAME, PENDING_STATE_ATTR_VALUE_HEX_DIGIT, PENDING_STATE_CDATA_BRACKET1, PENDING_STATE_CDATA_BRACKET2, PENDING_STATE_COMMENT_HYPHEN1, PENDING_STATE_COMMENT_HYPHEN2, PENDING_STATE_CR, PENDING_STATE_ENT_IN_DEC_DIGIT, PENDING_STATE_ENT_IN_HEX_DIGIT, PENDING_STATE_ENT_SEEN_HASH, PENDING_STATE_ENT_SEEN_HASH_X, PENDING_STATE_PI_QMARK, PENDING_STATE_TEXT_AMP, PENDING_STATE_TEXT_AMP_HASH, PENDING_STATE_TEXT_BRACKET1, PENDING_STATE_TEXT_BRACKET2, PENDING_STATE_TEXT_DEC_ENTITY, PENDING_STATE_TEXT_HEX_ENTITY, PENDING_STATE_TEXT_IN_ENTITY, PENDING_STATE_XMLDECL_LT, PENDING_STATE_XMLDECL_LTQ, PENDING_STATE_XMLDECL_TARGET, STATE_CDATA_C, STATE_CDATA_CD, STATE_CDATA_CDA, STATE_CDATA_CDAT, STATE_CDATA_CDATA, STATE_CDATA_CONTENT, STATE_COMMENT_CONTENT, STATE_COMMENT_HYPHEN, STATE_COMMENT_HYPHEN2, STATE_DEFAULT, STATE_DTD_AFTER_DOCTYPE, STATE_DTD_AFTER_PUBLIC, STATE_DTD_AFTER_PUBLIC_ID, STATE_DTD_AFTER_ROOT_NAME, STATE_DTD_AFTER_SYSTEM, STATE_DTD_AFTER_SYSTEM_ID, STATE_DTD_BEFORE_IDS, STATE_DTD_BEFORE_PUBLIC_ID, STATE_DTD_BEFORE_ROOT_NAME, STATE_DTD_BEFORE_SYSTEM_ID, STATE_DTD_DOCTYPE, STATE_DTD_EXPECT_CLOSING_GT, STATE_DTD_INT_SUBSET, STATE_DTD_PUBLIC_ID, STATE_DTD_PUBLIC_OR_SYSTEM, STATE_DTD_ROOT_NAME, STATE_DTD_SYSTEM_ID, STATE_EE_NEED_GT, STATE_PI_AFTER_TARGET, STATE_PI_AFTER_TARGET_QMARK, STATE_PI_AFTER_TARGET_WS, STATE_PI_IN_DATA, STATE_PI_IN_TARGET, STATE_PROLOG_DECL, STATE_PROLOG_INITIAL, STATE_PROLOG_SEEN_LT, STATE_SE_ATTR_NAME, STATE_SE_ATTR_VALUE_NORMAL, STATE_SE_ATTR_VALUE_NSDECL, STATE_SE_ELEM_NAME, STATE_SE_SEEN_SLASH, STATE_SE_SPACE_OR_ATTRNAME, STATE_SE_SPACE_OR_ATTRVALUE, STATE_SE_SPACE_OR_END, STATE_SE_SPACE_OR_EQ, STATE_TEXT_AMP, STATE_TEXT_AMP_NAME, STATE_TREE_NAMED_ENTITY_START, STATE_TREE_NUMERIC_ENTITY_START, STATE_TREE_SEEN_AMP, STATE_TREE_SEEN_EXCL, STATE_TREE_SEEN_LT, STATE_TREE_SEEN_SLASH, STATE_XMLDECL_AFTER_ENCODING, STATE_XMLDECL_AFTER_ENCODING_VALUE, STATE_XMLDECL_AFTER_STANDALONE, STATE_XMLDECL_AFTER_STANDALONE_VALUE, STATE_XMLDECL_AFTER_VERSION, STATE_XMLDECL_AFTER_VERSION_VALUE, STATE_XMLDECL_AFTER_XML, STATE_XMLDECL_BEFORE_ENCODING, STATE_XMLDECL_BEFORE_STANDALONE, STATE_XMLDECL_BEFORE_VERSION, STATE_XMLDECL_ENCODING, STATE_XMLDECL_ENCODING_EQ, STATE_XMLDECL_ENCODING_VALUE, STATE_XMLDECL_ENDQ, STATE_XMLDECL_STANDALONE, STATE_XMLDECL_STANDALONE_EQ, STATE_XMLDECL_STANDALONE_VALUE, STATE_XMLDECL_VERSION, STATE_XMLDECL_VERSION_EQ, STATE_XMLDECL_VERSION_VALUE_inputEnd, _inputPtr, _tmpChar, BYTE_a, BYTE_A, BYTE_AMP, BYTE_APOS, BYTE_C, BYTE_CR, BYTE_D, BYTE_EQ, BYTE_EXCL, BYTE_g, BYTE_GT, BYTE_HASH, BYTE_HYPHEN, BYTE_l, BYTE_LBRACKET, BYTE_LF, BYTE_LT, BYTE_m, BYTE_NULL, BYTE_o, BYTE_p, BYTE_P, BYTE_q, BYTE_QMARK, BYTE_QUOT, BYTE_RBRACKET, BYTE_s, BYTE_S, BYTE_SEMICOLON, BYTE_SLASH, BYTE_SPACE, BYTE_t, BYTE_T, BYTE_TAB, BYTE_u, BYTE_x_attrCollector, _attrCount, _cfgCoalescing, _cfgLazyParsing, _config, _currElem, _currNsCount, _currRow, _currToken, _defaultNs, _depth, _entityPending, _isEmptyTag, _lastNsContext, _lastNsDecl, _nameBuffer, _nsBindingCache, _nsBindingCount, _nsBindings, _nsBindMisses, _pastBytesOrChars, _publicId, _rowStartOffset, _startColumn, _startRawOffset, _startRow, _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_EOICHAR_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_UNKNOWNATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT| Constructor and Description |
|---|
AsyncByteBufferScanner(ReaderConfig cfg) |
| Modifier and Type | Method and Description |
|---|---|
protected byte |
_currentByte() |
protected byte |
_nextByte() |
protected byte |
_prevByte() |
protected boolean |
asyncSkipSpace()
Method to skip whatever space can be skipped.
|
protected boolean |
decodeDecEntity() |
protected int |
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 boolean |
decodeHexEntity() |
protected int |
decodeUtf8_2(int c)
Note: caller must guarantee enough data is available before
calling the method
|
protected int |
decodeUtf8_3(int c1)
Note: caller must guarantee enough data is available before
calling the method
|
protected int |
decodeUtf8_3(int c1,
int c2,
int c3) |
protected int |
decodeUtf8_4(int c) |
protected int |
decodeUtf8_4(int c1,
int c2,
int c3,
int c4) |
void |
feedInput(ByteBuffer buffer)
Method that can be called to feed more data, if (and only if)
AsyncInputFeeder.needMoreInput() returns true. |
protected void |
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 int |
finishCharactersCoalescing()
TODO: Method not yet implemented
|
protected boolean |
handleAttrValue() |
protected int |
handleCDataPending() |
protected int |
handleComment() |
protected int |
handleCommentPending() |
protected int |
handleDecEntityInCharacters(int ptr) |
protected boolean |
handleDTDInternalSubset(boolean init) |
protected int |
handleEntityInAttributeValue()
Method called to handle entity encountered inside attribute value.
|
protected int |
handleEntityInCharacters()
Method called to handle entity encountered inside
CHARACTERS segment, when trying to complete a non-coalescing text segment.
|
protected int |
handleEntityStartingToken()
Method called when a new token (within tree) starts with an
entity.
|
protected int |
handleHexEntityInCharacters(int ptr) |
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 |
handleNsDecl() |
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 boolean |
handlePartialCR()
Method called when there is a pending \r (from past buffer),
and we need to see
|
protected int |
handlePI() |
protected int |
handlePIPending() |
protected int |
handleStartElement() |
protected int |
handleStartElementStart(byte b)
Method called when
'<' and (what appears to be) a name
start character have been seen. |
boolean |
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).
|
int |
nextFromTree() |
protected int |
parseCDataContents() |
protected int |
parseCommentContents() |
protected PName |
parseEntityName() |
protected PName |
parseNewEntityName(byte b) |
protected PName |
parseNewName(byte b) |
protected int |
parsePIData() |
protected PName |
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 |
skipCharacters()
Method that will be called to skip all possible characters
from the input buffer, but without blocking.
|
protected boolean |
skipCoalescedText()
Coalescing mode is (and will) not be implemented for non-blocking
parsers, so this method should never get called.
|
protected void |
skipUtf8_2(int c) |
protected int |
startCharacters(byte b)
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).
|
String |
toString() |
_activateEncoding, _closeSource, _findXmlDeclName, _releaseBuffers, _startDocumentNoXmlDecl, addPName, checkPITargetName, decodeCharForError, endOfInput, findPName, finishCData, finishComment, finishDTD, finishPI, finishSpace, finishToken, loadMore, nextFromProlog, parseXmlDeclAttr, reportInvalidOther, skipCData, skipComment, skipPI, skipSpace, throwInternal, validPublicIdChar, verifyAndAppendEntityCharacter, verifyAndSetPublicId, verifyAndSetSystemId, verifyAndSetXmlEncoding, verifyAndSetXmlStandalone, verifyAndSetXmlVersionaddUTFPName, getCurrentColumnNr, getCurrentLocation, getEndingByteOffset, getEndingCharOffset, getStartingByteOffset, getStartingCharOffset, markLF, markLF, reportInvalidInitial, reportInvalidOther, setStartLocationbindName, bindNs, checkImmutableBinding, close, decodeAttrBinaryValue, decodeAttrValue, decodeAttrValues, decodeElements, findAttrIndex, findOrCreateBinding, fireSaxCharacterEvents, fireSaxCommentEvent, fireSaxEndElement, fireSaxPIEvent, fireSaxSpaceEvents, fireSaxStartElement, getAttrCollector, getAttrCount, getAttrLocalName, getAttrNsURI, getAttrPrefix, getAttrPrefixedName, getAttrQName, getAttrType, getAttrValue, getAttrValue, getConfig, getCurrentLineNr, getDepth, getDTDPublicId, getDTDSystemId, getEndLocation, getInputPublicId, getInputSystemId, getName, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getNonTransientNamespaceContext, getNsCount, getPrefix, getPrefixes, getQName, getStartLocation, getText, getText, getTextCharacters, getTextCharacters, getTextLength, handleInvalidXmlChar, hasEmptyStack, isAttrSpecified, isEmptyTag, isTextWhitespace, loadMoreGuaranteed, loadMoreGuaranteed, reportDoubleHyphenInComments, reportDuplicateNsDecl, reportEntityOverflow, reportEofInName, reportIllegalCDataEnd, reportIllegalNsDecl, reportIllegalNsDecl, reportInputProblem, reportInvalidNameChar, reportInvalidNsIndex, reportInvalidXmlChar, reportMissingPISpace, reportMultipleColonsInName, reportPrologProblem, reportPrologUnexpChar, reportPrologUnexpElement, reportTreeUnexpChar, reportUnboundPrefix, reportUnexpandedEntityInAttr, reportUnexpectedEndTag, resetForDecoding, skipToken, throwInvalidSpace, throwNullChar, throwUnexpectedChar, verifyXmlCharclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitendOfInputprotected ByteBuffer _inputBuffer
protected int _origBufferLen
public AsyncByteBufferScanner(ReaderConfig cfg)
protected final byte _currentByte()
throws XMLStreamException
_currentByte in class AsyncByteScannerXMLStreamExceptionprotected final byte _nextByte()
throws XMLStreamException
_nextByte in class AsyncByteScannerXMLStreamExceptionprotected final byte _prevByte()
throws XMLStreamException
_prevByte in class AsyncByteScannerXMLStreamExceptionprotected int parseCommentContents()
throws XMLStreamException
XMLStreamExceptionprotected int handleCommentPending()
throws XMLStreamException
XMLStreamExceptionprotected int parsePIData()
throws XMLStreamException
XMLStreamExceptionprotected int handlePIPending()
throws XMLStreamException
XMLStreamExceptionprotected final boolean handleDTDInternalSubset(boolean init)
throws XMLStreamException
handleDTDInternalSubset in class AsyncByteScannerXMLStreamExceptionprotected final int parseCDataContents()
throws XMLStreamException
XMLStreamExceptionprotected final int handleCDataPending()
throws XMLStreamException
XMLStreamExceptionprotected int startCharactersPending()
throws XMLStreamException
XMLStreamExceptionprotected final int finishCharactersCoalescing()
throws XMLStreamException
XMLStreamExceptionpublic final boolean needMoreInput()
AsyncInputFeederneedMoreInput in interface AsyncInputFeederpublic void feedInput(ByteBuffer buffer) throws XMLStreamException
AsyncByteBufferFeederAsyncInputFeeder.needMoreInput() returns true.feedInput in interface AsyncByteBufferFeederbuffer - Buffer that contains additional input to readXMLStreamException - 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)public int nextFromTree()
throws XMLStreamException
nextFromTree in class XmlScannerXMLStreamExceptionprotected int handlePI()
throws XMLStreamException
handlePI in class AsyncByteScannerXMLStreamExceptionprotected final int handleComment()
throws XMLStreamException
handleComment in class AsyncByteScannerXMLStreamExceptionprotected boolean asyncSkipSpace()
throws XMLStreamException
NOTE: if available content ends with a CR, method will set
_pendingInput to PENDING_STATE_CR.
asyncSkipSpace in class AsyncByteScannerXMLStreamExceptionprotected int handleEntityStartingToken()
throws XMLStreamException
XMLStreamExceptionprotected int handleNamedEntityStartingToken()
throws XMLStreamException
XMLStreamExceptionprotected int handleNumericEntityStartingToken()
throws XMLStreamException
XMLStreamExceptionprotected final boolean decodeHexEntity()
throws XMLStreamException
_entityValue;
false otherwiseXMLStreamExceptionprotected final boolean decodeDecEntity()
throws XMLStreamException
_entityValue;
false otherwiseXMLStreamExceptionprotected final int decodeGeneralEntity(PName entityName) throws XMLStreamException
XMLStreamExceptionprotected int handleStartElementStart(byte b)
throws XMLStreamException
'<' and (what appears to be) a name
start character have been seen.handleStartElementStart in class AsyncByteScannerXMLStreamExceptionprotected int handleStartElement()
throws XMLStreamException
handleStartElement in class AsyncByteScannerXMLStreamExceptionprotected final int startCharacters(byte b)
throws XMLStreamException
AsyncByteScannerXMLStreamReader.next() returns, no
blocking can occur when calling other methods.startCharacters in class AsyncByteScannerXMLStreamExceptionprotected final void finishCharacters()
throws XMLStreamException
finishCharacters in class AsyncByteScannerXMLStreamExceptionprotected int handleEntityInCharacters()
throws XMLStreamException
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.
XMLStreamExceptionprotected int handleDecEntityInCharacters(int ptr)
throws XMLStreamException
XMLStreamExceptionprotected int handleHexEntityInCharacters(int ptr)
throws XMLStreamException
XMLStreamExceptionprotected boolean skipCharacters()
throws XMLStreamException
skipCharacters in class AsyncByteScannerXMLStreamExceptionprotected boolean skipCoalescedText()
throws XMLStreamException
skipCoalescedText in class XmlScannerXMLStreamExceptionprotected boolean handleAttrValue()
throws XMLStreamException
handleAttrValue in class AsyncByteScannerXMLStreamExceptionprotected int handleEntityInAttributeValue()
throws XMLStreamException
XMLStreamExceptionprotected boolean handleNsDecl()
throws XMLStreamException
handleNsDecl in class AsyncByteScannerXMLStreamExceptionprotected final PName parseNewName(byte b) throws XMLStreamException
parseNewName in class AsyncByteScannerXMLStreamExceptionprotected final PName parsePName() throws XMLStreamException
Some notes about assumption implementation makes:
parsePName in class AsyncByteScannerXMLStreamExceptionprotected final PName parseNewEntityName(byte b) throws XMLStreamException
XMLStreamExceptionprotected final PName parseEntityName() throws XMLStreamException
XMLStreamExceptionprotected final boolean handlePartialCR()
handlePartialCR in class AsyncByteScannerprotected final int decodeUtf8_2(int c)
throws XMLStreamException
Note: caller must guarantee enough data is available before calling the method
XMLStreamExceptionprotected final void skipUtf8_2(int c)
throws XMLStreamException
XMLStreamExceptionprotected final int decodeUtf8_3(int c1)
throws XMLStreamException
Note: caller must guarantee enough data is available before calling the method
XMLStreamExceptionprotected final int decodeUtf8_3(int c1,
int c2,
int c3)
throws XMLStreamException
XMLStreamExceptionprotected final int decodeUtf8_4(int c)
throws XMLStreamException
XMLStreamExceptionprotected final int decodeUtf8_4(int c1,
int c2,
int c3,
int c4)
throws XMLStreamException
XMLStreamExceptionCopyright © 2019 FasterXML. All rights reserved.