Top Description Fields Constructors Methods
com.ctc.wstx.sr

public Class TypedStreamReader

extends BasicStreamReader
Class Inheritance
Known Direct Subclasses
com.ctc.wstx.sr.ValidatingStreamReader
Imports
java.math.BigDecimal, .BigInteger, javax.xml.namespace.QName, javax.xml.stream.XMLStreamException, org.codehaus.stax2.typed.Base64Variant, .Base64Variants, .TypedArrayDecoder, .TypedValueDecoder, .TypedXMLStreamException, org.codehaus.stax2.ri.Stax2Util, org.codehaus.stax2.ri.typed.ValueDecoderFactory, .CharArrayBase64Decoder, com.ctc.wstx.api.ReaderConfig, com.ctc.wstx.cfg.ErrorConsts, com.ctc.wstx.io.BranchingReaderSource, .InputBootstrapper, .WstxInputData

Complete implementation of org.codehaus.stax2.XMLStreamReader2, including Typed Access API (Stax2 v3.0) implementation. Only functionality missing is DTD validation, which is provided by a specialized sub-class.

Field Summary

Modifier and TypeField and Description
protected CharArrayBase64Decoder
_base64Decoder

Lazily-constructed decoder object for decoding base64 encoded element binary content.

protected ValueDecoderFactory
_decoderFactory

Factory used for constructing decoders we need for typed access

protected static final int
MASK_TYPED_ACCESS_ARRAY

Mask of event types that are legal (starting) states to call Typed Access API from.

protected static final int
pack-priv static final int
MIN_BINARY_CHUNK

Minimum length of text chunks to parse before base64 decoding.

Inherited from com.ctc.wstx.sr.BasicStreamReader:
ALL_WS_NOALL_WS_UNKNOWNALL_WS_YESDOC_STANDALONE_NODOC_STANDALONE_UNKNOWNDOC_STANDALONE_YESMASK_GET_ELEMENT_TEXTMASK_GET_TEXTMASK_GET_TEXT_WITH_WRITERMASK_GET_TEXT_XXXmAttrCollectormCfgCoalesceTextmCfgLazyParsingmCfgReportTextAsCharsmCheckIndentationmConfigFlagsmCurrTextLengthmCurrTokenmDocStandalonemDtdPublicIdmDtdSystemIdmElementStackmGeneralEntitiesmOwnermParseStatemPendingExceptionmReturnNullForDefaultNamespacemRootLNamemRootPrefixmSecondaryTokenmShortestTextSegmentmStDoctypeFoundmStEmptyElemmStTextThresholdmTextBuffermTokenStatemValidateTextmVldContentmWsStatussPrefixXmlsPrefixXmlnsSTATE_CLOSEDSTATE_EPILOGSTATE_MULTIDOC_HACKSTATE_PROLOGSTATE_TREETOKEN_FULL_COALESCEDTOKEN_FULL_SINGLETOKEN_NOT_STARTEDTOKEN_PARTIAL_SINGLETOKEN_STARTED

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected CharArrayBase64Decoder
protected TypedXMLStreamException
_constructTypeException(IllegalArgumentException
Problem as reported by converter
iae
,
String
Lexical value (element content, attribute value) that could not be converted succesfully.
lexicalValue
)

Method called to wrap or convert given conversion-fail exception into a full TypedXMLStreamException,

protected ValueDecoderFactory
private void
_handleEmptyValue(TypedValueDecoder dec)

Method called to handle value that has empty String as representation.

private final void
_initBinaryChunks(Base64Variant v, CharArrayBase64Decoder dec, int type, boolean isFirst)

protected QName
_verifyQName(QName n)

Method called to verify validity of the parsed QName element or attribute value.

public static TypedStreamReader
createStreamReader(BranchingReaderSource
Input source used to read the XML document.
input
,
ReaderCreator
"Owner" of this reader, factory that created the reader; needed for returning updated symbol table information after parsing.
owner
,
ReaderConfig
Object that contains reader configuration info.
cfg
,
InputBootstrapper bs, boolean forER)

Factory method for constructing readers.

public void
getAttributeAs(int index, TypedValueDecoder tvd)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAs.

Generic access method that can be used for efficient decoding of additional types not support natively by the typed stream reader.

public int

Returns:

Number of tokens decoded, 0 if none found
getAttributeAsArray
(int index, TypedArrayDecoder tad)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsArray.

Method that allows reading contents of an attribute as an array of whitespace-separate tokens, decoded using specified decoder.

public byte[]
getAttributeAsBinary(int
The attribute's index as returned by getAttributeIndex(String, String).
index
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsBinary.

Read an attribute value as a byte array.

public byte[]
public boolean
getAttributeAsBoolean(int
The attribute's index as returned by getAttributeIndex(String, String)
index
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsBoolean.

Read an attribute value as a boolean.

public BigDecimal
public double
public double[]
public float
public float[]
public int
getAttributeAsInt(int
The attribute's index as returned by getAttributeIndex(String, String)
index
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsInt.

Read an attribute value as a boolean.

public int[]
getAttributeAsIntArray(int
The attribute's index as returned by getAttributeIndex(String, String).
index
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsIntArray.

Read an attribute content as an int array.

public BigInteger
public long
getAttributeAsLong(int
The attribute's index as returned by getAttributeIndex(String, String)
index
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeAsLong.

Read an attribute value as a boolean.

public long[]
public QName
public int
getAttributeIndex(String
The attribute's namespace URI. Values of null and "" are considered the same, i.e. "no namespace" (or "empty" namespace)
namespaceURI
,
String
The attribute's local name.
localName
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getAttributeIndex.

Returns the index of the attribute whose local name is localName and URI is namespaceURI or -1 if no such attribute exists.

public void
getElementAs(TypedValueDecoder tvd)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAs.

Generic decoding method that can be used for efficient decoding of additional types not support natively by the typed stream reader.

public final byte[]
getElementAsBinary()

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsBinary.

Convenience method that can be used similar to read binary content instead of readElementAsBinary, in cases where neither performance nor memory usage is a big concern.

public byte[]
getElementAsBinary(Base64Variant
Base64 variant content is in; needed to decode alternative variants ("modified base64")
v
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsBinary.

Convenience method that can be used similar to read binary content instead of readElementAsBinary, in cases where neither performance nor memory usage is a big concern.

public boolean
public BigDecimal
public double
getElementAsDouble()

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsDouble.

Read an element content as a 64-bit floating point value.

public float
getElementAsFloat()

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsFloat.

Read an element content as a 32-bit floating point value.

public int
getElementAsInt()

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsInt.

Read an element content as a 32-bit integer.

public BigInteger
public long
getElementAsLong()

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.getElementAsLong.

Read an element content as a 64-bit integer.

public QName
public final int

Returns:

Number of elements decoded (if any were decoded), or -1 to indicate that no more values can be decoded.
readElementAsArray
(TypedArrayDecoder dec)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.readElementAsArray.

Method called to parse array of primitives.

public final int
readElementAsBinary(byte[] resultBuffer, int offset, int maxLength)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.readElementAsBinary.

public int
readElementAsBinary(byte[]
Array in which to copy decoded bytes.
resultBuffer
,
int
Starting offset of the first decoded byte within result buffer
offset
,
int
Maximum number of bytes to decode with this call
maxLength
,
Base64Variant v)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.readElementAsBinary.

Read element content as decoded byte sequence; possibly only reading a fragment of all element content.

public int
public int
public int
readElementAsIntArray(int[]
The array in which to copy the ints.
value
,
int
The index in the array from which copying starts.
from
,
int
The maximun number of ints to copy. Minimum value is 1; others an IllegalArgumentException is thrown
length
)

Implements org.codehaus.stax2.typed.TypedXMLStreamReader.readElementAsIntArray.

Read an element content as an int array.

public int
Inherited from com.ctc.wstx.sr.BasicStreamReader:
_constructTypeException_constructUnexpectedInTypedcheckCDatacheckKeywordclosecloseCompletelycreateElementStackensureFinishTokenfindEntityfinishDTDfinishTokenfireSaxCharacterEventsfireSaxCommentEventfireSaxEndElementfireSaxPIEventfireSaxSpaceEventsfireSaxStartElementgetAttributeCollectorgetAttributeCountgetAttributeInfogetAttributeLocalNamegetAttributeNamegetAttributeNamespacegetAttributePrefixgetAttributeTypegetAttributeValuegetAttributeValuegetCharacterEncodingSchemegetCurrentEntityDeclgetDepthgetDTDInfogetDTDInternalSubsetgetDTDPublicIdgetDTDRootNamegetDTDSystemIdgetElementTextgetEncodinggetEndingByteOffsetgetEndingCharOffsetgetEndLocationgetEventTypegetFeaturegetInputElementStackgetLocalNamegetLocationgetLocationInfogetNamegetNamespaceContextgetNamespaceCountgetNamespacePrefixgetNamespaceURIgetNamespaceURIgetNamespaceURIgetNonTransientNamespaceContextgetPIDatagetPITargetgetPrefixgetPrefixedNamegetProcessedDTDgetProcessedDTDSchemagetPropertygetStartingByteOffsetgetStartingCharOffsetgetTextgetTextgetTextCharactersgetTextCharactersgetTextLengthgetTextStartgetVersionhandleEOFhandleGreedyEntityProblemhandleIncompleteEntityProblemhandleMultiDocStarthandleMultiDocXmlDeclhandleRootElemhandleUndeclaredEntityhasConfigFlagshasNamehasNexthasTextinitValidationisAttributeSpecifiedisCharactersisEmptyElementisEndElementisNamespaceAwareisPropertySupportedisStandaloneisStartElementisWhiteSpacenextnextTagparseQuotedreadCDataSecondaryreadCoalescedTextreadEndElemreadTextSecondaryreportInvalidContentrequiresafeEnsureFinishTokensafeFinishTokensetFeaturesetPropertysetValidationProblemHandlerskipElementskipEqualsskipWSstandaloneSetstopValidatingAgainststopValidatingAgainstthrowNotTextualOrElemthrowUnexpectedEOFvalidateAgainstwithStartElement