com.fasterxml.aalto.in
Class StreamReaderImpl

java.lang.Object
  extended by com.fasterxml.aalto.in.StreamReaderImpl
All Implemented Interfaces:
XMLStreamConstants, XMLStreamReader, org.codehaus.stax2.AttributeInfo, org.codehaus.stax2.DTDInfo, org.codehaus.stax2.LocationInfo, org.codehaus.stax2.typed.TypedXMLStreamReader, org.codehaus.stax2.validation.Validatable, org.codehaus.stax2.XMLStreamReader2

public final class StreamReaderImpl
extends Object
implements org.codehaus.stax2.XMLStreamReader2, org.codehaus.stax2.AttributeInfo, org.codehaus.stax2.DTDInfo, org.codehaus.stax2.LocationInfo

Basic backend-independent XMLStreamReader implementation. While the read implements Stax API, most of real work is delegated to input (and thereby, encoding) specific backend implementations.


Field Summary
protected  int _attrCount
          If the current event is START_ELEMENT, number of attributes the start element has.
protected  org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder
          Lazily-constructed decoder object for decoding base64 encoded element binary content.
protected  boolean _cfgCoalesceText
           
protected  boolean _cfgReportTextAsChars
           
protected  PName _currName
          Prefixed name associated with the current event, if any.
protected  int _currToken
           
protected  org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory
          Factory used for constructing decoders we need for typed access
protected  int _parseState
          Main parsing/tokenization state (STATE_xxx)
protected  XmlScanner _scanner
          Underlying XML scanner
 
Fields inherited from interface org.codehaus.stax2.XMLStreamReader2
FEATURE_DTD_OVERRIDE
 
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
 
Constructor Summary
StreamReaderImpl(XmlScanner scanner)
           
 
Method Summary
protected  org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder()
           
protected  void _closeScanner(boolean forceStreamClose)
          Method called to close scanner, by asking it to release resource it has, and potentially also close the underlying stream.
protected  XMLStreamException _constructUnexpectedInTyped(int nextToken)
           
protected  org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory()
           
 void close()
           Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader.
 void closeCompletely()
           
static StreamReaderImpl construct(InputBootstrapper bs)
           
 int findAttributeIndex(String nsURI, String localName)
           
 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)
           
 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)
           
 BigInteger getAttributeAsInteger(int index)
           
 long getAttributeAsLong(int index)
           
 long[] getAttributeAsLongArray(int index)
           
 QName getAttributeAsQName(int index)
           
 int getAttributeCount()
           
 int getAttributeIndex(String namespaceURI, String localName)
           
 org.codehaus.stax2.AttributeInfo getAttributeInfo()
           
 String getAttributeLocalName(int index)
           
 QName getAttributeName(int index)
           
 String getAttributeNamespace(int index)
           
 String getAttributePrefix(int index)
           
 String getAttributeType(int index)
           
 String getAttributeValue(int index)
           
 String getAttributeValue(String nsURI, String localName)
           
 String getCharacterEncodingScheme()
          As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.
 org.codehaus.stax2.XMLStreamLocation2 getCurrentLocation()
           
 int getDepth()
           
 org.codehaus.stax2.DTDInfo getDTDInfo()
          Since this class implements DTDInfo, method can just return this.
 String getDTDInternalSubset()
           
 String getDTDPublicId()
           
 String getDTDRootName()
           
 String getDTDSystemId()
           
 void getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd)
           
 byte[] getElementAsBinary()
           
 byte[] getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v)
           
 boolean getElementAsBoolean()
           
 BigDecimal getElementAsDecimal()
           
 double getElementAsDouble()
           
 float getElementAsFloat()
           
 int getElementAsInt()
           
 BigInteger getElementAsInteger()
           
 long getElementAsLong()
           
 QName getElementAsQName()
           
 String getElementText()
          From StAX specs: Reads the content of a text-only element, an exception is thrown if this is not a text-only element.
 String getEncoding()
          As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out.
 long getEndingByteOffset()
           
 long getEndingCharOffset()
           
 org.codehaus.stax2.XMLStreamLocation2 getEndLocation()
           
 int getEventType()
          Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.
 Object getFeature(String name)
           
 int getIdAttributeIndex()
           
protected  Location getLastCharLocation()
           
 String getLocalName()
           
 Location getLocation()
           
 org.codehaus.stax2.LocationInfo getLocationInfo()
          Location information is always accessible, for this reader.
 QName getName()
           
 NamespaceContext getNamespaceContext()
           
 int getNamespaceCount()
           
 String getNamespacePrefix(int index)
           
 String getNamespaceURI()
           
 String getNamespaceURI(int index)
           
 String getNamespaceURI(String prefix)
           
 NamespaceContext getNonTransientNamespaceContext()
           
 int getNotationAttributeIndex()
           
 String getPIData()
           
 String getPITarget()
           
 String getPrefix()
           
 String getPrefixedName()
           
 Object getProcessedDTD()
           Note: DTD-handling sub-classes need to override this method.
 org.codehaus.stax2.validation.DTDValidationSchema getProcessedDTDSchema()
          Sub-class will override this method
 Object getProperty(String name)
           
 XmlScanner getScanner()
          Should not really be public, but needed by SAX code
 long getStartingByteOffset()
           
 long getStartingCharOffset()
           
 org.codehaus.stax2.XMLStreamLocation2 getStartLocation()
           
 String getText()
           
 int getText(Writer w, boolean preserveContents)
          Method similar to getText(), except that it just uses provided Writer to write all textual content.
 char[] getTextCharacters()
           
 int getTextCharacters(int srcStart, char[] target, int targetStart, int len)
           
 int getTextLength()
           
 int getTextStart()
           
 String getVersion()
           
protected  int handlePrologEoi(boolean isProlog)
           
protected  void handleTreeEoi()
          Method called when hitting an end-of-input within tree, after a valid token
 boolean hasName()
           
 boolean hasNext()
           
 boolean hasText()
           
 boolean isAttributeSpecified(int index)
           
 boolean isCharacters()
           
 boolean isEmptyElement()
           
 boolean isEndElement()
           
 boolean isPropertySupported(String name)
           
 boolean isStandalone()
           
 boolean isStartElement()
           
 boolean isWhiteSpace()
           
 int next()
           
 int nextTag()
           
 int readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec)
           
 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)
           
protected  void reportInvalidAttrIndex(int index)
           
 void require(int type, String nsUri, String localName)
           
 void setFeature(String name, Object value)
           
 boolean setProperty(String name, Object value)
           
 org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h)
           
 void skipElement()
           
 boolean standaloneSet()
           
 org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
           
 org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator)
           
protected  void throwFromIOE(IOException ioe)
           
protected  void throwUnexpectedEOI(String msg)
           
protected  void throwWfe(String msg)
          Throws generic parse error with specified message and current parsing location.
 String toString()
           
 org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
           
protected  QName verifyQName(QName n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_scanner

protected final XmlScanner _scanner
Underlying XML scanner


_cfgCoalesceText

protected final boolean _cfgCoalesceText

_cfgReportTextAsChars

protected final boolean _cfgReportTextAsChars

_currToken

protected int _currToken

_parseState

protected int _parseState
Main parsing/tokenization state (STATE_xxx)


_currName

protected PName _currName
Prefixed name associated with the current event, if any.


_attrCount

protected int _attrCount
If the current event is START_ELEMENT, number of attributes the start element has. Otherwise undefined. Updated by reader, to make index checks for other attribute access methods simpler.


_decoderFactory

protected org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory
Factory used for constructing decoders we need for typed access


_base64Decoder

protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder
Lazily-constructed decoder object for decoding base64 encoded element binary content.

Constructor Detail

StreamReaderImpl

public StreamReaderImpl(XmlScanner scanner)
Method Detail

construct

public static StreamReaderImpl construct(InputBootstrapper bs)
                                  throws XMLStreamException
Throws:
XMLStreamException

getScanner

public XmlScanner getScanner()
Should not really be public, but needed by SAX code


getCharacterEncodingScheme

public String getCharacterEncodingScheme()
As per Stax (1.0) specs, needs to return whatever xml declaration claimed encoding is, if any; or null if no xml declaration found.

Note: method name is rather confusing (compare to getEncoding()).

Specified by:
getCharacterEncodingScheme in interface XMLStreamReader

getEncoding

public String getEncoding()
As per Stax (1.0) specs, needs to return whatever parser determined the encoding was, if it was able to figure it out. If not (there are cases where this can not be found; specifically when being passed a Reader), it should return null.

Specified by:
getEncoding in interface XMLStreamReader

getVersion

public String getVersion()
Specified by:
getVersion in interface XMLStreamReader

isStandalone

public boolean isStandalone()
Specified by:
isStandalone in interface XMLStreamReader

standaloneSet

public boolean standaloneSet()
Specified by:
standaloneSet in interface XMLStreamReader

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface XMLStreamReader

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface XMLStreamReader
Specified by:
getAttributeCount in interface org.codehaus.stax2.AttributeInfo

getAttributeLocalName

public String getAttributeLocalName(int index)
Specified by:
getAttributeLocalName in interface XMLStreamReader

getAttributeName

public QName getAttributeName(int index)
Specified by:
getAttributeName in interface XMLStreamReader

getAttributeNamespace

public String getAttributeNamespace(int index)
Specified by:
getAttributeNamespace in interface XMLStreamReader

getAttributePrefix

public String getAttributePrefix(int index)
Specified by:
getAttributePrefix in interface XMLStreamReader

getAttributeType

public String getAttributeType(int index)
Specified by:
getAttributeType in interface XMLStreamReader

getAttributeValue

public String getAttributeValue(int index)
Specified by:
getAttributeValue in interface XMLStreamReader

getAttributeValue

public String getAttributeValue(String nsURI,
                                String localName)
Specified by:
getAttributeValue in interface XMLStreamReader

getElementText

public String getElementText()
                      throws XMLStreamException
From StAX specs:
Reads the content of a text-only element, an exception is thrown if this is not a text-only element. Regardless of value of javax.xml.stream.isCoalescing this method always returns coalesced content.
Precondition: the current event is START_ELEMENT.
Postcondition: the current event is the corresponding END_ELEMENT.

Specified by:
getElementText in interface XMLStreamReader
Throws:
XMLStreamException

getEventType

public int getEventType()
Returns type of the last event returned; or START_DOCUMENT before any events has been explicitly returned.

Specified by:
getEventType in interface XMLStreamReader

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface XMLStreamReader

getName

public QName getName()
Specified by:
getName in interface XMLStreamReader

getNamespaceContext

public NamespaceContext getNamespaceContext()
Specified by:
getNamespaceContext in interface XMLStreamReader

getNamespaceCount

public int getNamespaceCount()
Specified by:
getNamespaceCount in interface XMLStreamReader

getNamespacePrefix

public String getNamespacePrefix(int index)
Specified by:
getNamespacePrefix in interface XMLStreamReader

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface XMLStreamReader

getNamespaceURI

public String getNamespaceURI(int index)
Specified by:
getNamespaceURI in interface XMLStreamReader

getNamespaceURI

public String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface XMLStreamReader

getPIData

public String getPIData()
Specified by:
getPIData in interface XMLStreamReader

getPITarget

public String getPITarget()
Specified by:
getPITarget in interface XMLStreamReader

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface XMLStreamReader

getText

public String getText()
Specified by:
getText in interface XMLStreamReader

getTextCharacters

public char[] getTextCharacters()
Specified by:
getTextCharacters in interface XMLStreamReader

getTextCharacters

public int getTextCharacters(int srcStart,
                             char[] target,
                             int targetStart,
                             int len)
Specified by:
getTextCharacters in interface XMLStreamReader

getTextLength

public int getTextLength()
Specified by:
getTextLength in interface XMLStreamReader

getTextStart

public int getTextStart()
Specified by:
getTextStart in interface XMLStreamReader

hasName

public boolean hasName()
Specified by:
hasName in interface XMLStreamReader

hasNext

public boolean hasNext()
Specified by:
hasNext in interface XMLStreamReader

hasText

public boolean hasText()
Specified by:
hasText in interface XMLStreamReader

isAttributeSpecified

public boolean isAttributeSpecified(int index)
Specified by:
isAttributeSpecified in interface XMLStreamReader

isCharacters

public boolean isCharacters()
Specified by:
isCharacters in interface XMLStreamReader

isEndElement

public boolean isEndElement()
Specified by:
isEndElement in interface XMLStreamReader

isStartElement

public boolean isStartElement()
Specified by:
isStartElement in interface XMLStreamReader

isWhiteSpace

public boolean isWhiteSpace()
Specified by:
isWhiteSpace in interface XMLStreamReader

require

public void require(int type,
                    String nsUri,
                    String localName)
             throws XMLStreamException
Specified by:
require in interface XMLStreamReader
Throws:
XMLStreamException

next

public int next()
         throws XMLStreamException
Specified by:
next in interface XMLStreamReader
Throws:
XMLStreamException

nextTag

public int nextTag()
            throws XMLStreamException
Specified by:
nextTag in interface XMLStreamReader
Throws:
XMLStreamException

close

public void close()
           throws XMLStreamException

Note: as per StAX 1.0 specs, this method does NOT close the underlying input reader. (that is, unless the new StAX2 property org.codehaus.stax2.XMLInputFactory2#P_AUTO_CLOSE_INPUT is set to true).

Specified by:
close in interface XMLStreamReader
Throws:
XMLStreamException

getLocation

public Location getLocation()
Specified by:
getLocation in interface XMLStreamReader
Specified by:
getLocation in interface org.codehaus.stax2.LocationInfo

getElementAsBoolean

public boolean getElementAsBoolean()
                            throws XMLStreamException
Specified by:
getElementAsBoolean in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsInt

public int getElementAsInt()
                    throws XMLStreamException
Specified by:
getElementAsInt in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsLong

public long getElementAsLong()
                      throws XMLStreamException
Specified by:
getElementAsLong in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsFloat

public float getElementAsFloat()
                        throws XMLStreamException
Specified by:
getElementAsFloat in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsDouble

public double getElementAsDouble()
                          throws XMLStreamException
Specified by:
getElementAsDouble in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsInteger

public BigInteger getElementAsInteger()
                               throws XMLStreamException
Specified by:
getElementAsInteger in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsDecimal

public BigDecimal getElementAsDecimal()
                               throws XMLStreamException
Specified by:
getElementAsDecimal in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsQName

public QName getElementAsQName()
                        throws XMLStreamException
Specified by:
getElementAsQName in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsBinary

public final byte[] getElementAsBinary()
                                throws XMLStreamException
Specified by:
getElementAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAs

public void getElementAs(org.codehaus.stax2.typed.TypedValueDecoder tvd)
                  throws XMLStreamException
Specified by:
getElementAs in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getElementAsBinary

public byte[] getElementAsBinary(org.codehaus.stax2.typed.Base64Variant v)
                          throws XMLStreamException
Specified by:
getElementAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsIntArray

public int readElementAsIntArray(int[] value,
                                 int from,
                                 int length)
                          throws XMLStreamException
Specified by:
readElementAsIntArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsLongArray

public int readElementAsLongArray(long[] value,
                                  int from,
                                  int length)
                           throws XMLStreamException
Specified by:
readElementAsLongArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsFloatArray

public int readElementAsFloatArray(float[] value,
                                   int from,
                                   int length)
                            throws XMLStreamException
Specified by:
readElementAsFloatArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsDoubleArray

public int readElementAsDoubleArray(double[] value,
                                    int from,
                                    int length)
                             throws XMLStreamException
Specified by:
readElementAsDoubleArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsArray

public final int readElementAsArray(org.codehaus.stax2.typed.TypedArrayDecoder dec)
                             throws XMLStreamException
Specified by:
readElementAsArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsBinary

public final int readElementAsBinary(byte[] resultBuffer,
                                     int offset,
                                     int maxLength)
                              throws XMLStreamException
Specified by:
readElementAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

readElementAsBinary

public int readElementAsBinary(byte[] resultBuffer,
                               int offset,
                               int maxLength,
                               org.codehaus.stax2.typed.Base64Variant v)
                        throws XMLStreamException
Specified by:
readElementAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeIndex

public int getAttributeIndex(String namespaceURI,
                             String localName)
Specified by:
getAttributeIndex in interface org.codehaus.stax2.typed.TypedXMLStreamReader

getAttributeAsBoolean

public boolean getAttributeAsBoolean(int index)
                              throws XMLStreamException
Specified by:
getAttributeAsBoolean in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsInt

public int getAttributeAsInt(int index)
                      throws XMLStreamException
Specified by:
getAttributeAsInt in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsLong

public long getAttributeAsLong(int index)
                        throws XMLStreamException
Specified by:
getAttributeAsLong in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsFloat

public float getAttributeAsFloat(int index)
                          throws XMLStreamException
Specified by:
getAttributeAsFloat in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsDouble

public double getAttributeAsDouble(int index)
                            throws XMLStreamException
Specified by:
getAttributeAsDouble in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsInteger

public BigInteger getAttributeAsInteger(int index)
                                 throws XMLStreamException
Specified by:
getAttributeAsInteger in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsDecimal

public BigDecimal getAttributeAsDecimal(int index)
                                 throws XMLStreamException
Specified by:
getAttributeAsDecimal in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsQName

public QName getAttributeAsQName(int index)
                          throws XMLStreamException
Specified by:
getAttributeAsQName in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAs

public void getAttributeAs(int index,
                           org.codehaus.stax2.typed.TypedValueDecoder tvd)
                    throws XMLStreamException
Specified by:
getAttributeAs in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsIntArray

public int[] getAttributeAsIntArray(int index)
                             throws XMLStreamException
Specified by:
getAttributeAsIntArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsLongArray

public long[] getAttributeAsLongArray(int index)
                               throws XMLStreamException
Specified by:
getAttributeAsLongArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsFloatArray

public float[] getAttributeAsFloatArray(int index)
                                 throws XMLStreamException
Specified by:
getAttributeAsFloatArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsDoubleArray

public double[] getAttributeAsDoubleArray(int index)
                                   throws XMLStreamException
Specified by:
getAttributeAsDoubleArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsArray

public int getAttributeAsArray(int index,
                               org.codehaus.stax2.typed.TypedArrayDecoder tad)
                        throws XMLStreamException
Method that allows reading contents of an attribute as an array of whitespace-separate tokens, decoded using specified decoder.

Specified by:
getAttributeAsArray in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Returns:
Number of tokens decoded, 0 if none found
Throws:
XMLStreamException

getAttributeAsBinary

public byte[] getAttributeAsBinary(int index)
                            throws XMLStreamException
Specified by:
getAttributeAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

getAttributeAsBinary

public byte[] getAttributeAsBinary(int index,
                                   org.codehaus.stax2.typed.Base64Variant v)
                            throws XMLStreamException
Specified by:
getAttributeAsBinary in interface org.codehaus.stax2.typed.TypedXMLStreamReader
Throws:
XMLStreamException

verifyQName

protected QName verifyQName(QName n)
                     throws org.codehaus.stax2.typed.TypedXMLStreamException
Throws:
org.codehaus.stax2.typed.TypedXMLStreamException

getFeature

public Object getFeature(String name)
Specified by:
getFeature in interface org.codehaus.stax2.XMLStreamReader2

setFeature

public void setFeature(String name,
                       Object value)
Specified by:
setFeature in interface org.codehaus.stax2.XMLStreamReader2

isPropertySupported

public boolean isPropertySupported(String name)
Specified by:
isPropertySupported in interface org.codehaus.stax2.XMLStreamReader2

setProperty

public boolean setProperty(String name,
                           Object value)
Specified by:
setProperty in interface org.codehaus.stax2.XMLStreamReader2
Parameters:
name - Name of the property to set
value - Value to set property to.
Returns:
True, if the specified property was succesfully set to specified value; false if its value was not changed

skipElement

public void skipElement()
                 throws XMLStreamException
Specified by:
skipElement in interface org.codehaus.stax2.XMLStreamReader2
Throws:
XMLStreamException

getAttributeInfo

public org.codehaus.stax2.AttributeInfo getAttributeInfo()
                                                  throws XMLStreamException
Specified by:
getAttributeInfo in interface org.codehaus.stax2.XMLStreamReader2
Throws:
XMLStreamException

getDTDInfo

public org.codehaus.stax2.DTDInfo getDTDInfo()
                                      throws XMLStreamException
Since this class implements DTDInfo, method can just return this.

Specified by:
getDTDInfo in interface org.codehaus.stax2.XMLStreamReader2
Throws:
XMLStreamException

getLocationInfo

public final org.codehaus.stax2.LocationInfo getLocationInfo()
Location information is always accessible, for this reader.

Specified by:
getLocationInfo in interface org.codehaus.stax2.XMLStreamReader2

getText

public int getText(Writer w,
                   boolean preserveContents)
            throws XMLStreamException
Method similar to getText(), except that it just uses provided Writer to write all textual content. For further optimization, it may also be allowed to do true pass-through, thus possibly avoiding one temporary copy of the data.

TODO: try to optimize to allow completely streaming pass-through: currently will still read all data in memory buffers before outputting

Specified by:
getText in interface org.codehaus.stax2.XMLStreamReader2
Parameters:
w - Writer to use for writing textual contents
preserveContents - If true, reader has to preserve contents so that further calls to getText will return proper conntets. If false, reader is allowed to skip creation of such copies: this can improve performance, but it also means that further calls to getText is not guaranteed to return meaningful data.
Returns:
Number of characters written to the reader
Throws:
XMLStreamException

getDepth

public int getDepth()
Specified by:
getDepth in interface org.codehaus.stax2.XMLStreamReader2
Returns:
Number of open elements in the stack; 0 when parser is in prolog/epilog, 1 inside root element and so on.

isEmptyElement

public boolean isEmptyElement()
                       throws XMLStreamException
Specified by:
isEmptyElement in interface org.codehaus.stax2.XMLStreamReader2
Returns:
True, if cursor points to a start or end element that is constructed from 'empty' element (ends with '/>'); false otherwise.
Throws:
XMLStreamException

getNonTransientNamespaceContext

public NamespaceContext getNonTransientNamespaceContext()
Specified by:
getNonTransientNamespaceContext in interface org.codehaus.stax2.XMLStreamReader2

getPrefixedName

public String getPrefixedName()
Specified by:
getPrefixedName in interface org.codehaus.stax2.XMLStreamReader2

closeCompletely

public void closeCompletely()
                     throws XMLStreamException
Specified by:
closeCompletely in interface org.codehaus.stax2.XMLStreamReader2
Throws:
XMLStreamException

getProcessedDTD

public Object getProcessedDTD()

Note: DTD-handling sub-classes need to override this method.

Specified by:
getProcessedDTD in interface org.codehaus.stax2.DTDInfo

getDTDRootName

public String getDTDRootName()
Specified by:
getDTDRootName in interface org.codehaus.stax2.DTDInfo

getDTDPublicId

public String getDTDPublicId()
Specified by:
getDTDPublicId in interface org.codehaus.stax2.DTDInfo

getDTDSystemId

public String getDTDSystemId()
Specified by:
getDTDSystemId in interface org.codehaus.stax2.DTDInfo

getDTDInternalSubset

public String getDTDInternalSubset()
Specified by:
getDTDInternalSubset in interface org.codehaus.stax2.DTDInfo
Returns:
Internal subset portion of the DOCTYPE declaration, if any; empty String if none

getProcessedDTDSchema

public org.codehaus.stax2.validation.DTDValidationSchema getProcessedDTDSchema()
Sub-class will override this method

Specified by:
getProcessedDTDSchema in interface org.codehaus.stax2.DTDInfo

getStartingByteOffset

public long getStartingByteOffset()
Specified by:
getStartingByteOffset in interface org.codehaus.stax2.LocationInfo

getStartingCharOffset

public long getStartingCharOffset()
Specified by:
getStartingCharOffset in interface org.codehaus.stax2.LocationInfo

getEndingByteOffset

public long getEndingByteOffset()
                         throws XMLStreamException
Specified by:
getEndingByteOffset in interface org.codehaus.stax2.LocationInfo
Throws:
XMLStreamException

getEndingCharOffset

public long getEndingCharOffset()
                         throws XMLStreamException
Specified by:
getEndingCharOffset in interface org.codehaus.stax2.LocationInfo
Throws:
XMLStreamException

getStartLocation

public final org.codehaus.stax2.XMLStreamLocation2 getStartLocation()
Specified by:
getStartLocation in interface org.codehaus.stax2.LocationInfo

getEndLocation

public final org.codehaus.stax2.XMLStreamLocation2 getEndLocation()
                                                           throws XMLStreamException
Specified by:
getEndLocation in interface org.codehaus.stax2.LocationInfo
Throws:
XMLStreamException

getCurrentLocation

public final org.codehaus.stax2.XMLStreamLocation2 getCurrentLocation()
Specified by:
getCurrentLocation in interface org.codehaus.stax2.LocationInfo

findAttributeIndex

public int findAttributeIndex(String nsURI,
                              String localName)
Specified by:
findAttributeIndex in interface org.codehaus.stax2.AttributeInfo

getIdAttributeIndex

public int getIdAttributeIndex()
Specified by:
getIdAttributeIndex in interface org.codehaus.stax2.AttributeInfo

getNotationAttributeIndex

public int getNotationAttributeIndex()
Specified by:
getNotationAttributeIndex in interface org.codehaus.stax2.AttributeInfo

validateAgainst

public org.codehaus.stax2.validation.XMLValidator validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
                                                           throws XMLStreamException
Specified by:
validateAgainst in interface org.codehaus.stax2.validation.Validatable
Throws:
XMLStreamException

stopValidatingAgainst

public org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema schema)
                                                                 throws XMLStreamException
Specified by:
stopValidatingAgainst in interface org.codehaus.stax2.validation.Validatable
Throws:
XMLStreamException

stopValidatingAgainst

public org.codehaus.stax2.validation.XMLValidator stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidator validator)
                                                                 throws XMLStreamException
Specified by:
stopValidatingAgainst in interface org.codehaus.stax2.validation.Validatable
Throws:
XMLStreamException

setValidationProblemHandler

public org.codehaus.stax2.validation.ValidationProblemHandler setValidationProblemHandler(org.codehaus.stax2.validation.ValidationProblemHandler h)
Specified by:
setValidationProblemHandler in interface org.codehaus.stax2.validation.Validatable

getLastCharLocation

protected Location getLastCharLocation()

handlePrologEoi

protected int handlePrologEoi(boolean isProlog)
                       throws XMLStreamException
Throws:
XMLStreamException

handleTreeEoi

protected void handleTreeEoi()
                      throws XMLStreamException
Method called when hitting an end-of-input within tree, after a valid token

Throws:
XMLStreamException

throwWfe

protected void throwWfe(String msg)
                 throws XMLStreamException
Throws generic parse error with specified message and current parsing location.

Throws:
XMLStreamException

throwFromIOE

protected void throwFromIOE(IOException ioe)
                     throws XMLStreamException
Throws:
XMLStreamException

throwUnexpectedEOI

protected void throwUnexpectedEOI(String msg)
                           throws XMLStreamException
Throws:
XMLStreamException

_constructUnexpectedInTyped

protected XMLStreamException _constructUnexpectedInTyped(int nextToken)

reportInvalidAttrIndex

protected void reportInvalidAttrIndex(int index)

_closeScanner

protected void _closeScanner(boolean forceStreamClose)
                      throws XMLStreamException
Method called to close scanner, by asking it to release resource it has, and potentially also close the underlying stream.

Throws:
XMLStreamException

_decoderFactory

protected final org.codehaus.stax2.ri.typed.ValueDecoderFactory _decoderFactory()

_base64Decoder

protected org.codehaus.stax2.ri.typed.CharArrayBase64Decoder _base64Decoder()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010 Fasterxml.com. All Rights Reserved.