public class TypedStreamReader extends BasicStreamReader
XMLStreamReader2,
including Typed Access API (Stax2 v3.0) implementation.
Only functionality missing is DTD validation, which is provided by a
specialized sub-class.| Modifier and Type | Field and Description |
|---|---|
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder |
_base64Decoder
Lazily-constructed decoder object for decoding base64 encoded
element binary content.
|
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory |
_decoderFactory
Factory used for constructing decoders we need for typed access
|
protected static int |
MASK_TYPED_ACCESS_ARRAY
Mask of event types that are legal (starting) states
to call Typed Access API from.
|
protected static int |
MASK_TYPED_ACCESS_BINARY |
(package private) static int |
MIN_BINARY_CHUNK
Minimum length of text chunks to parse before base64 decoding.
|
ALL_WS_NO, ALL_WS_UNKNOWN, ALL_WS_YES, DOC_STANDALONE_NO, DOC_STANDALONE_UNKNOWN, DOC_STANDALONE_YES, MASK_GET_ELEMENT_TEXT, MASK_GET_TEXT, MASK_GET_TEXT_WITH_WRITER, MASK_GET_TEXT_XXX, mAttrCollector, mCfgCoalesceText, mCfgLazyParsing, mCfgReportTextAsChars, mCheckIndentation, mConfigFlags, mCurrTextLength, mCurrToken, mDocStandalone, mDtdPublicId, mDtdSystemId, mElementStack, mGeneralEntities, mOwner, mParseState, mPendingException, mReturnNullForDefaultNamespace, mRootLName, mRootPrefix, mSecondaryToken, mShortestTextSegment, mStDoctypeFound, mStEmptyElem, mStTextThreshold, mTextBuffer, mTokenState, mValidateText, mVldContent, mWsStatus, sPrefixXml, sPrefixXmlns, STATE_CLOSED, STATE_EPILOG, STATE_MULTIDOC_HACK, STATE_PROLOG, STATE_TREE, TOKEN_FULL_COALESCED, TOKEN_FULL_SINGLE, TOKEN_NOT_STARTED, TOKEN_PARTIAL_SINGLE, TOKEN_STARTEDCHAR_CR_LF_OR_NULL, CHAR_FIRST_PURE_TEXT, CHAR_LOWEST_LEGAL_LOCALNAME_CHAR, INT_CR_LF_OR_NULL, mCachedEntities, mCfgNsEnabled, mCfgReplaceEntities, mCfgTreatCharRefsAsEntities, mConfig, mCurrDepth, mCurrEntity, mCurrName, mDocInputEncoding, mDocXmlEncoding, mDocXmlVersion, mEntityExpansionCount, mEntityResolver, mInput, mInputTopDepth, mNameBuffer, mNormalizeLFs, mRootInput, mSymbols, mTokenInputCol, mTokenInputRow, mTokenInputTotalCHAR_NULL, CHAR_SPACE, INT_NULL, INT_SPACE, MAX_UNICODE_CHAR, mCurrInputProcessed, mCurrInputRow, mCurrInputRowStart, mInputBuffer, mInputEnd, mInputPtr, mXml11ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENTCFG_AUTO_CLOSE_INPUT, CFG_CACHE_DTDS, CFG_CACHE_DTDS_BY_PUBLIC_ID, CFG_COALESCE_TEXT, CFG_INTERN_NAMES, CFG_INTERN_NS_URIS, CFG_LAZY_PARSING, CFG_NAMESPACE_AWARE, CFG_NORMALIZE_LFS, CFG_PRESERVE_LOCATION, CFG_REPLACE_ENTITY_REFS, CFG_REPORT_CDATA, CFG_REPORT_PROLOG_WS, CFG_SUPPORT_DTD, CFG_SUPPORT_DTDPP, CFG_SUPPORT_EXTERNAL_ENTITIES, CFG_TREAT_CHAR_REFS_AS_ENTS, CFG_VALIDATE_AGAINST_DTD, CFG_XMLID_TYPING, CFG_XMLID_UNIQ_CHECKSSUFFIX_EOF_EXP_NAME, SUFFIX_IN_ATTR_VALUE, SUFFIX_IN_CDATA, SUFFIX_IN_CLOSE_ELEMENT, SUFFIX_IN_COMMENT, SUFFIX_IN_DEF_ATTR_VALUE, SUFFIX_IN_DOC, SUFFIX_IN_DTD, SUFFIX_IN_DTD_EXTERNAL, SUFFIX_IN_DTD_INTERNAL, SUFFIX_IN_ELEMENT, SUFFIX_IN_ENTITY_REF, SUFFIX_IN_EPILOG, SUFFIX_IN_NAME, SUFFIX_IN_PROC_INSTR, SUFFIX_IN_PROLOG, SUFFIX_IN_TEXT, SUFFIX_IN_XML_DECL| Modifier | Constructor and Description |
|---|---|
protected |
TypedStreamReader(InputBootstrapper bs,
BranchingReaderSource input,
ReaderCreator owner,
ReaderConfig cfg,
InputElementStack elemStack,
boolean forER) |
| Modifier and Type | Method and Description |
|---|---|
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder |
_base64Decoder() |
protected org.codehaus.stax2.typed.TypedXMLStreamException |
_constructTypeException(java.lang.IllegalArgumentException iae,
java.lang.String lexicalValue)
Method called to wrap or convert given conversion-fail exception
into a full
TypedXMLStreamException, |
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory |
_decoderFactory() |
private void |
_handleEmptyValue(org.codehaus.stax2.typed.TypedValueDecoder dec)
Method called to handle value that has empty String
as representation.
|
private void |
_initBinaryChunks(org.codehaus.stax2.typed.Base64Variant v,
org.codehaus.stax2.ri.typed.CharArrayBase64Decoder dec,
int type,
boolean isFirst) |
protected javax.xml.namespace.QName |
_verifyQName(javax.xml.namespace.QName n)
Method called to verify validity of the parsed QName element
or attribute value.
|
static TypedStreamReader |
createStreamReader(BranchingReaderSource input,
ReaderCreator owner,
ReaderConfig cfg,
InputBootstrapper bs,
boolean forER)
Factory method for constructing readers.
|
void |
getAttributeAs(int index,
org.codehaus.stax2.typed.TypedValueDecoder tvd) |
int |
getAttributeAsArray(int index,
org.codehaus.stax2.typed.TypedArrayDecoder tad)
Method that allows reading contents of an attribute as an array
of whitespace-separate tokens, decoded using specified decoder.
|
byte[] |
getAttributeAsBinary(int index) |
byte[] |
getAttributeAsBinary(int index,
org.codehaus.stax2.typed.Base64Variant v) |
boolean |
getAttributeAsBoolean(int index) |
java.math.BigDecimal |
getAttributeAsDecimal(int index) |
double |
getAttributeAsDouble(int index) |
double[] |
getAttributeAsDoubleArray(int index) |
float |
getAttributeAsFloat(int index) |
float[] |
getAttributeAsFloatArray(int index) |
int |
getAttributeAsInt(int index) |
int[] |
getAttributeAsIntArray(int index) |
java.math.BigInteger |
getAttributeAsInteger(int index) |
long |
getAttributeAsLong(int index) |
long[] |
getAttributeAsLongArray(int index) |
javax.xml.namespace.QName |
getAttributeAsQName(int index) |
int |
getAttributeIndex(java.lang.String namespaceURI,
java.lang.String localName) |
void |
getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd) |
byte[] |
getElementAsBinary() |
byte[] |
getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v) |
boolean |
getElementAsBoolean() |
java.math.BigDecimal |
getElementAsDecimal() |
double |
getElementAsDouble() |
float |
getElementAsFloat() |
int |
getElementAsInt() |
java.math.BigInteger |
getElementAsInteger() |
long |
getElementAsLong() |
javax.xml.namespace.QName |
getElementAsQName() |
int |
readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec)
Method called to parse array of primitives.
|
int |
readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength) |
int |
readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength,
org.codehaus.stax2.typed.Base64Variant v) |
int |
readElementAsDoubleArray(double[] value,
int from,
int length) |
int |
readElementAsFloatArray(float[] value,
int from,
int length) |
int |
readElementAsIntArray(int[] value,
int from,
int length) |
int |
readElementAsLongArray(long[] value,
int from,
int length) |
_constructTypeException, _constructUnexpectedInTyped, checkCData, checkKeyword, close, closeCompletely, createElementStack, ensureFinishToken, findEntity, finishDTD, finishToken, fireSaxCharacterEvents, fireSaxCommentEvent, fireSaxEndElement, fireSaxPIEvent, fireSaxSpaceEvents, fireSaxStartElement, getAttributeCollector, getAttributeCount, getAttributeInfo, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getCurrentEntityDecl, getDepth, getDTDInfo, getDTDInternalSubset, getDTDPublicId, getDTDRootName, getDTDSystemId, getElementText, getEncoding, getEndingByteOffset, getEndingCharOffset, getEndLocation, getEventType, getFeature, getInputElementStack, getLocalName, getLocation, getLocationInfo, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getNonTransientNamespaceContext, getPIData, getPITarget, getPrefix, getPrefixedName, getProcessedDTD, getProcessedDTDSchema, getProperty, getStartingByteOffset, getStartingCharOffset, getText, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, handleEOF, handleGreedyEntityProblem, handleIncompleteEntityProblem, handleMultiDocStart, handleMultiDocXmlDecl, handleRootElem, handleUndeclaredEntity, hasConfigFlags, hasName, hasNext, hasText, initValidation, isAttributeSpecified, isCharacters, isEmptyElement, isEndElement, isNamespaceAware, isPropertySupported, isStandalone, isStartElement, isWhiteSpace, next, nextTag, parseQuoted, readCDataSecondary, readCoalescedText, readEndElem, readTextSecondary, reportInvalidContent, require, safeEnsureFinishToken, safeFinishToken, setFeature, setProperty, setValidationProblemHandler, skipElement, skipEquals, skipWS, standaloneSet, stopValidatingAgainst, stopValidatingAgainst, throwNotTextualOrElem, throwUnexpectedEOF, validateAgainst, withStartElement_reportProblem, _reportProblem, closeAllInput, constructFromIOE, constructLimitViolation, constructNullCharException, constructWfcException, ensureInput, expandBy50Pct, expandEntity, fullyResolveEntity, getCurrentInput, getCurrentLocation, getIntEntity, getLastCharLocation, getNameBuffer, getNext, getNextAfterWS, getNextChar, getNextCharAfterWS, getNextCharFromCurrent, getNextInCurrAfterWS, getNextInCurrAfterWS, getSource, getStartLocation, getSystemId, initInputSource, inputInBuffer, loadMore, loadMore, loadMoreFromCurrent, loadMoreFromCurrent, markLF, markLF, parseEntityName, parseFNameForError, parseFullName, parseFullName, parseFullName2, parseLocalName, parseLocalName2, parsePublicId, parseSystemId, parseUntil, peekNext, pushback, reportProblem, reportProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, resolveCharOnlyEntity, resolveNonCharEntity, resolveSimpleEntity, skipCRLF, skipFullName, throwFromIOE, throwFromStrE, throwInvalidSpace, throwInvalidSpace, throwLazyError, throwNullChar, throwNullParent, throwParseError, throwParseError, throwUnexpectedChar, throwUnexpectedEOB, throwUnexpectedEOF, throwWfcException, tokenTypeDesc, verifyLimitcopyBufferStateFrom, findIllegalNameChar, findIllegalNmtokenChar, getCharDesc, isNameChar, isNameChar, isNameStartChar, isNameStartChar, isSpaceCharprotected static final int MASK_TYPED_ACCESS_ARRAY
protected static final int MASK_TYPED_ACCESS_BINARY
static final int MIN_BINARY_CHUNK
protected org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder
protected TypedStreamReader(InputBootstrapper bs, BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputElementStack elemStack, boolean forER) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic static TypedStreamReader createStreamReader(BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputBootstrapper bs, boolean forER) throws javax.xml.stream.XMLStreamException
owner - "Owner" of this reader, factory that created the reader;
needed for returning updated symbol table information after parsing.input - Input source used to read the XML document.cfg - Object that contains reader configuration info.javax.xml.stream.XMLStreamExceptionpublic boolean getElementAsBoolean()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int getElementAsInt()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic long getElementAsLong()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic float getElementAsFloat()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic double getElementAsDouble()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic java.math.BigInteger getElementAsInteger()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic java.math.BigDecimal getElementAsDecimal()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic javax.xml.namespace.QName getElementAsQName()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic final byte[] getElementAsBinary()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic byte[] getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic void getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int readElementAsIntArray(int[] value,
int from,
int length)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int readElementAsLongArray(long[] value,
int from,
int length)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int readElementAsFloatArray(float[] value,
int from,
int length)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int readElementAsDoubleArray(double[] value,
int from,
int length)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic final int readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec)
throws javax.xml.stream.XMLStreamException
!!! 05-Sep-2008, tatu: Current implementation is not optimal either performance-wise, or from getting accurate Location for decoding problems. But it works otherwise, and we need to get Woodstox 4.0 out by the end of the year... so it'll do, for now.
javax.xml.stream.XMLStreamExceptionpublic final int readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength,
org.codehaus.stax2.typed.Base64Variant v)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprivate final void _initBinaryChunks(org.codehaus.stax2.typed.Base64Variant v,
org.codehaus.stax2.ri.typed.CharArrayBase64Decoder dec,
int type,
boolean isFirst)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int getAttributeIndex(java.lang.String namespaceURI,
java.lang.String localName)
public boolean getAttributeAsBoolean(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int getAttributeAsInt(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic long getAttributeAsLong(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic float getAttributeAsFloat(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic double getAttributeAsDouble(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic java.math.BigInteger getAttributeAsInteger(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic java.math.BigDecimal getAttributeAsDecimal(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic javax.xml.namespace.QName getAttributeAsQName(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic void getAttributeAs(int index,
org.codehaus.stax2.typed.TypedValueDecoder tvd)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int[] getAttributeAsIntArray(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic long[] getAttributeAsLongArray(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic float[] getAttributeAsFloatArray(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic double[] getAttributeAsDoubleArray(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic int getAttributeAsArray(int index,
org.codehaus.stax2.typed.TypedArrayDecoder tad)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic byte[] getAttributeAsBinary(int index)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic byte[] getAttributeAsBinary(int index,
org.codehaus.stax2.typed.Base64Variant v)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected javax.xml.namespace.QName _verifyQName(javax.xml.namespace.QName n)
throws org.codehaus.stax2.typed.TypedXMLStreamException
org.codehaus.stax2.typed.TypedXMLStreamExceptionprotected org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory()
protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder()
private void _handleEmptyValue(org.codehaus.stax2.typed.TypedValueDecoder dec)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected org.codehaus.stax2.typed.TypedXMLStreamException _constructTypeException(java.lang.IllegalArgumentException iae,
java.lang.String lexicalValue)
TypedXMLStreamException,iae - Problem as reported by converterlexicalValue - Lexical value (element content, attribute value)
that could not be converted succesfully.