public class StreamReader2Delegate extends StreamReaderDelegate implements XMLStreamReader2
| Modifier and Type | Field and Description |
|---|---|
protected XMLStreamReader2 |
mDelegate2 |
FEATURE_DTD_OVERRIDEATTRIBUTE, 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 |
|---|
StreamReader2Delegate(XMLStreamReader2 sr) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeCompletely()
Method similar to
XMLStreamReader.close(),
except that this method also does close the underlying input
source if it has not yet been closed. |
void |
getAttributeAs(int index,
TypedValueDecoder tvd)
Generic access method that can be used for efficient
decoding of additional types not support natively
by the typed stream reader.
|
int |
getAttributeAsArray(int index,
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)
Read an attribute value as a byte array.
|
byte[] |
getAttributeAsBinary(int index,
Base64Variant v) |
boolean |
getAttributeAsBoolean(int index)
Read an attribute value as a boolean.
|
BigDecimal |
getAttributeAsDecimal(int index) |
double |
getAttributeAsDouble(int index) |
double[] |
getAttributeAsDoubleArray(int index) |
float |
getAttributeAsFloat(int index) |
float[] |
getAttributeAsFloatArray(int index) |
int |
getAttributeAsInt(int index)
Read an attribute value as a boolean.
|
int[] |
getAttributeAsIntArray(int index)
Read an attribute content as an int array.
|
BigInteger |
getAttributeAsInteger(int index) |
long |
getAttributeAsLong(int index)
Read an attribute value as a boolean.
|
long[] |
getAttributeAsLongArray(int index) |
QName |
getAttributeAsQName(int index) |
int |
getAttributeIndex(String namespaceURI,
String localName)
Returns the index of the attribute whose local name is
localName and URI is namespaceURI
or -1 if no such attribute exists. |
AttributeInfo |
getAttributeInfo()
Method that can be called to get additional information about
attributes related to the current start element, as well as
related DTD-based information if available.
|
int |
getDepth()
Method that returns the number of open elements in the stack; 0 when
the reader is in prolog/epilog, 1 inside root element (including
when pointing at the root element itself) and so on.
|
DTDInfo |
getDTDInfo()
Method that can be called to get information about DOCTYPE declaration
that the reader is currently pointing to, if the reader has parsed
it.
|
void |
getElementAs(TypedValueDecoder tvd)
Generic decoding method that can be used for efficient
decoding of additional types not support natively
by the typed stream reader.
|
byte[] |
getElementAsBinary()
Convenience method that can be used similar to read binary content
instead of
TypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant), in cases where neither performance nor
memory usage is a big concern. |
byte[] |
getElementAsBinary(Base64Variant v)
Convenience method that can be used similar to read binary content
instead of
TypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant), in cases where neither performance nor
memory usage is a big concern. |
boolean |
getElementAsBoolean()
Read an element content as a boolean.
|
BigDecimal |
getElementAsDecimal() |
double |
getElementAsDouble()
Read an element content as a 64-bit floating point value.
|
float |
getElementAsFloat()
Read an element content as a 32-bit floating point value.
|
int |
getElementAsInt()
Read an element content as a 32-bit integer.
|
BigInteger |
getElementAsInteger() |
long |
getElementAsLong()
Read an element content as a 64-bit integer.
|
QName |
getElementAsQName() |
Object |
getFeature(String name)
Method that can be used to get per-reader values; both generic
ones (names for which are defined as constants in this class),
and implementation dependant ones.
|
LocationInfo |
getLocationInfo() |
NamespaceContext |
getNonTransientNamespaceContext()
This method returns a namespace context object that contains
information identical to that returned by
XMLStreamReader.getNamespaceContext(),
but one that is
not transient. |
String |
getPrefixedName()
This method returns "prefix-qualified" name of the current
element.
|
int |
getText(Writer w,
boolean preserveContents)
Method similar to
XMLStreamReader.getText(), except
that it just uses provided Writer to write all textual content,
and that it works for wider range of event types. |
boolean |
isEmptyElement()
Method that can be used to check whether current START_ELEMENT
event was created for an empty element (xml short-hand notation
where one tag implies start and end, ending with "/>"), or not.
|
boolean |
isPropertySupported(String name)
Method similar to
XMLInputFactory.isPropertySupported(java.lang.String), used
to determine whether a property is supported by the Reader
instance. |
int |
readElementAsArray(TypedArrayDecoder tad)
Read an element content as an array of tokens.
|
int |
readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength) |
int |
readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength,
Base64Variant v)
Read element content as decoded byte sequence; possibly only
reading a fragment of all element content.
|
int |
readElementAsDoubleArray(double[] value,
int from,
int length) |
int |
readElementAsFloatArray(float[] value,
int from,
int length) |
int |
readElementAsIntArray(int[] value,
int from,
int length)
Read an element content as an int array.
|
int |
readElementAsLongArray(long[] value,
int from,
int length) |
void |
setFeature(String name,
Object value)
Method that can be used to set per-reader features such as configuration
settings; both generic
ones (names for which are defined as constants in this class),
and implementation dependant ones.
|
void |
setParent(XMLStreamReader pr) |
boolean |
setProperty(String name,
Object value)
Method that can be used to set per-reader properties; a subset of
properties one can set via matching
XMLInputFactory2
instance. |
ValidationProblemHandler |
setValidationProblemHandler(ValidationProblemHandler h)
Method that application can call to define a custom handler for
validation problems encountered during validation process.
|
void |
skipElement()
Method that will skip all the contents of the element that the
stream currently points to.
|
XMLValidator |
stopValidatingAgainst(XMLValidationSchema schema)
Method that can be called by application to stop validating
output against a schema, for which
Validatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier. |
XMLValidator |
stopValidatingAgainst(XMLValidator validator)
Method that can be called by application to stop validating
output using specified validator.
|
XMLValidator |
validateAgainst(XMLValidationSchema schema)
Method that will construct a
XMLValidator instance from the
given schema (unless a validator for that schema has already been
added),
initialize it if necessary, and make validatable object (reader,
writer)
call appropriate validation methods from this point on until the
end of the document (that is, it's not scoped with sub-trees), or until
validator is removed by an explicit call to
Validatable.stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema). |
close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getParent, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, next, nextTag, require, standaloneSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getElementText, getEncoding, getEventType, getLocalName, getLocation, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getPIData, getPITarget, getPrefix, getProperty, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasName, hasNext, hasText, isAttributeSpecified, isCharacters, isEndElement, isStandalone, isStartElement, isWhiteSpace, next, nextTag, require, standaloneSetprotected XMLStreamReader2 mDelegate2
public StreamReader2Delegate(XMLStreamReader2 sr)
public void setParent(XMLStreamReader pr)
setParent in class StreamReaderDelegatepublic void closeCompletely()
throws XMLStreamException
XMLStreamReader2XMLStreamReader.close(),
except that this method also does close the underlying input
source if it has not yet been closed. It is generally preferable
to call this method if the parsing ends in an exception;
and for some input sources (when passing
a File or URL for factory
method) it has to be called as the application does not have
access to the actually input source (InputStream
opened from a URL and so on).closeCompletely in interface XMLStreamReader2XMLStreamExceptionpublic AttributeInfo getAttributeInfo() throws XMLStreamException
XMLStreamReader2IllegalStateException will be thrown.getAttributeInfo in interface XMLStreamReader2XMLStreamExceptionpublic DTDInfo getDTDInfo() throws XMLStreamException
XMLStreamReader2getDTDInfo in interface XMLStreamReader2XMLStreamExceptionpublic int getDepth()
XMLStreamReader2getDepth in interface XMLStreamReader2public Object getFeature(String name)
XMLStreamReader2
Note: although some feature names are shared with
XMLStreamReader2.setFeature(java.lang.String, java.lang.Object), not all are: some features are read-only,
some write-only
getFeature in interface XMLStreamReader2name - Name of the feature of which value to getpublic LocationInfo getLocationInfo()
getLocationInfo in interface XMLStreamReader2public NamespaceContext getNonTransientNamespaceContext()
XMLStreamReader2XMLStreamReader.getNamespaceContext(),
but one that is
not transient. That is, one that will remain valid and unchanged
after its creation. This allows the namespace context to be used
independent of its source documents life cycle. One possible use
case is to use this namespace context for 'initializing' writers
(especially ones that use repairing mode) with optimal/preferred name
space bindings.getNonTransientNamespaceContext in interface XMLStreamReader2public String getPrefixedName()
XMLStreamReader2
Note: implementations are encouraged to provide an implementation
that would be more efficient than calling getLocalName
and getPrefix separately, but are not required to do
so. Nonetheless it is usually at least as efficient (if not more)
to call this method as to do it fully in calling code.
getPrefixedName in interface XMLStreamReader2public int getText(Writer w, boolean preserveContents) throws IOException, XMLStreamException
XMLStreamReader2XMLStreamReader.getText(), except
that it just uses provided Writer to write all textual content,
and that it works for wider range of event types.
For further optimization, it may also be allowed to do true
pass-through, thus possibly avoiding one temporary copy of the
data. Finally, note that this method is also guaranteed NOT
to return fragments, even when coalescing is not enabled and
a parser is otherwised allowed to return partial segments: this
requirement is due to there being little benefit in returning
such short chunks when streaming. Coalescing property is still
honored normally.
Method can only be called on states CDATA, CHARACTERS, COMMENT,
DTD, ENTITY_REFERENCE, SPACE and PROCESSING_INSTRUCTION; if called
when reader is in another state,
IllegalStateException will be thrown. Content written
for elements is same as with XMLStreamReader.getText().
getText in interface XMLStreamReader2w - Writer to use for writing textual contentspreserveContents - 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.IOExceptionXMLStreamExceptionpublic boolean isEmptyElement()
throws XMLStreamException
XMLStreamReader2
Note: method may need to read more data to know if the element
is an empty one, and as such may throw an i/o or parsing exception
(as XMLStreamException); however, it won't throw exceptions
for non-START_ELEMENT event types.
isEmptyElement in interface XMLStreamReader2XMLStreamExceptionpublic boolean isPropertySupported(String name)
XMLStreamReader2XMLInputFactory.isPropertySupported(java.lang.String), used
to determine whether a property is supported by the Reader
instance. This means that this method may return false
for some properties that the input factory does support: specifically,
it should only return true if the value is mutable on per-instance
basis. False means that either the property is not recognized, or
is not mutable via reader instance.isPropertySupported in interface XMLStreamReader2public void setFeature(String name, Object value)
XMLStreamReader2
Note: although some feature names are shared with
XMLStreamReader2.getFeature(java.lang.String), not all are: some features are read-only,
some write-only
setFeature in interface XMLStreamReader2name - Name of the feature to setvalue - Value to set feature to.public boolean setProperty(String name, Object value)
XMLStreamReader2XMLInputFactory2
instance. Exactly which methods are mutable is implementation
specific.setProperty in interface XMLStreamReader2name - Name of the property to setvalue - Value to set property to.public void skipElement()
throws XMLStreamException
XMLStreamReader2IllegalStateException
is thrown); after the call the stream will point to the matching
END_ELEMENT event, having skipped zero or more intervening events
for the contents.skipElement in interface XMLStreamReader2XMLStreamExceptionpublic ValidationProblemHandler setValidationProblemHandler(ValidationProblemHandler h)
ValidatablesetValidationProblemHandler in interface Validatableh - Handler to install, if non null; if null, indicates that
the default (implementation-specific) handling should be usedpublic XMLValidator stopValidatingAgainst(XMLValidationSchema schema) throws XMLStreamException
ValidatableValidatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier.stopValidatingAgainst in interface ValidatableXMLStreamExceptionpublic XMLValidator stopValidatingAgainst(XMLValidator validator) throws XMLStreamException
ValidatableValidatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema).
Note: the specified validator is compared for identity with validators in use, not for equality.
stopValidatingAgainst in interface Validatablevalidator)
if it was being used for validating current document; null if not.XMLStreamExceptionpublic XMLValidator validateAgainst(XMLValidationSchema schema) throws XMLStreamException
ValidatableXMLValidator instance from the
given schema (unless a validator for that schema has already been
added),
initialize it if necessary, and make validatable object (reader,
writer)
call appropriate validation methods from this point on until the
end of the document (that is, it's not scoped with sub-trees), or until
validator is removed by an explicit call to
Validatable.stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema).
Note that while this method can be called at any point in output processing, validator instances are not required to be able to handle addition at other points than right before outputting the root element.
validateAgainst in interface ValidatableXMLStreamExceptionpublic int getAttributeIndex(String namespaceURI, String localName)
TypedXMLStreamReaderlocalName and URI is namespaceURI
or -1 if no such attribute exists.getAttributeIndex in interface TypedXMLStreamReadernamespaceURI - The attribute's namespace URI. Values of
null and "" are considered the same, i.e. "no namespace"
(or "empty" namespace)localName - The attribute's local name.-1 if no
such attribute exists.public boolean getAttributeAsBoolean(int index)
throws XMLStreamException
TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema boolean data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema boolean data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema boolean data type.
getAttributeAsBoolean in interface TypedXMLStreamReaderindex - The attribute's index as returned by TypedXMLStreamReader.getAttributeIndex(String, String)XMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public BigDecimal getAttributeAsDecimal(int index) throws XMLStreamException
getAttributeAsDecimal in interface TypedXMLStreamReaderXMLStreamExceptionpublic double getAttributeAsDouble(int index)
throws XMLStreamException
getAttributeAsDouble in interface TypedXMLStreamReaderXMLStreamExceptionpublic float getAttributeAsFloat(int index)
throws XMLStreamException
getAttributeAsFloat in interface TypedXMLStreamReaderXMLStreamExceptionpublic int getAttributeAsInt(int index)
throws XMLStreamException
TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
getAttributeAsInt in interface TypedXMLStreamReaderindex - The attribute's index as returned by TypedXMLStreamReader.getAttributeIndex(String, String)XMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public BigInteger getAttributeAsInteger(int index) throws XMLStreamException
getAttributeAsInteger in interface TypedXMLStreamReaderXMLStreamExceptionpublic long getAttributeAsLong(int index)
throws XMLStreamException
TypedXMLStreamReaderRead an attribute value as a boolean. The lexical representation of a boolean is defined by the XML Schema long data type. Whitespace MUST be collapsed according to the whiteSpace facet for the type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema long data type.
getAttributeAsLong in interface TypedXMLStreamReaderindex - The attribute's index as returned by TypedXMLStreamReader.getAttributeIndex(String, String)XMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public QName getAttributeAsQName(int index) throws XMLStreamException
getAttributeAsQName in interface TypedXMLStreamReaderXMLStreamExceptionpublic int[] getAttributeAsIntArray(int index)
throws XMLStreamException
TypedXMLStreamReaderRead an attribute content as an int array. The lexical representation of a int array is defined by the following XML schema type:
<xs:simpleType name="intArray">
<xs:list itemType="xs:int"/>
</xs:simpleType>
whose lexical space is a list of space-separated ints.
Whitespace MUST be
collapsed
according to the whiteSpace facet for the intArray
type shown above. An exception is thrown if, after whitespace is
collapsed, the resulting sequence of characters is not in
the lexical space defined by the intArray data
type.getAttributeAsIntArray in interface TypedXMLStreamReaderindex - The attribute's index as returned by TypedXMLStreamReader.getAttributeIndex(String, String).XMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public long[] getAttributeAsLongArray(int index)
throws XMLStreamException
getAttributeAsLongArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic float[] getAttributeAsFloatArray(int index)
throws XMLStreamException
getAttributeAsFloatArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic double[] getAttributeAsDoubleArray(int index)
throws XMLStreamException
getAttributeAsDoubleArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic void getElementAs(TypedValueDecoder tvd) throws XMLStreamException
TypedXMLStreamReaderXMLStreamReader.getElementText(),
and then call one of decode methods defined in
TypedValueDecoder. The only difference is that
passed value will be trimmed: that is, any leading or
trailing white space will be removed prior to calling
decode method.
After the call, passed
decoder object will have decoded and stored value
(if succesful) or thrown an exception (if not).
The main benefit of using this method (over just getting
all content by calling XMLStreamReader.getElementText()
is efficiency: the stream reader can efficiently gather all textual
content necessary and pass it to the decoder, often avoiding
construction of intemediate Strings.
These are the pre- and post-conditions of calling this method:
Note that caller has to know more specific type of decoder, since the base interface does not specify methods for accessing actual decoded value.
getElementAs in interface TypedXMLStreamReaderXMLStreamExceptionpublic boolean getElementAsBoolean()
throws XMLStreamException
TypedXMLStreamReaderRead an element content as a boolean. The lexical representation of a boolean is defined by the XML Schema boolean data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema boolean data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema boolean data type. (note: allowed lexical values are canonicals "true" and "false", as well as non-canonical "0" and "1")
These are the pre- and post-conditions of calling this method:
getElementAsBoolean in interface TypedXMLStreamReaderXMLStreamException - If unable to access contentTypedXMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public BigDecimal getElementAsDecimal() throws XMLStreamException
getElementAsDecimal in interface TypedXMLStreamReaderXMLStreamExceptionpublic double getElementAsDouble()
throws XMLStreamException
TypedXMLStreamReaderRead an element content as a 64-bit floating point value.
The lexical representation is defined by the
XML Schema double data type. Whitespace MUST be
collapsed
according to the whiteSpace facet for the XML Schema double data type.
An exception is thrown if, after whitespace is
collapsed, the resulting sequence of characters is not in
the lexical space defined by the XML Schema integer data type.
Note that valid representations include basic Java textual
representations, as well as 3 special tokens: "INF", "-INF"
and "NaN"
These are the pre and post conditions of calling this method:
getElementAsDouble in interface TypedXMLStreamReaderXMLStreamException - If unable to access contentTypedXMLStreamException - If unable to convert the resulting
character sequence into a Java doublepublic float getElementAsFloat()
throws XMLStreamException
TypedXMLStreamReaderRead an element content as a 32-bit floating point value.
The lexical representation is defined by the
XML Schema float data type. Whitespace MUST be
collapsed
according to the whiteSpace facet for the XML Schema float data type.
An exception is thrown if, after whitespace is
collapsed, the resulting sequence of characters is not in
the lexical space defined by the XML Schema integer data type.
Note that valid representations include basic Java textual
representations, as well as 3 special tokens: "INF", "-INF"
and "NaN"
These are the pre and post conditions of calling this method:
getElementAsFloat in interface TypedXMLStreamReaderXMLStreamException - If unable to access contentTypedXMLStreamException - If unable to convert the resulting
character sequence into a Java floatpublic int getElementAsInt()
throws XMLStreamException
TypedXMLStreamReaderRead an element content as a 32-bit integer. The lexical representation of a integer is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema integer data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
These are the pre and post conditions of calling this method:
getElementAsInt in interface TypedXMLStreamReaderXMLStreamException - If unable to access contentTypedXMLStreamException - If unable to convert the resulting
character sequence into a Java (32-bit) integer.public BigInteger getElementAsInteger() throws XMLStreamException
getElementAsInteger in interface TypedXMLStreamReaderXMLStreamExceptionpublic long getElementAsLong()
throws XMLStreamException
TypedXMLStreamReaderRead an element content as a 64-bit integer. The lexical representation of a integer is defined by the XML Schema integer data type. Whitespace MUST be collapsed according to the whiteSpace facet for the XML Schema integer data type. An exception is thrown if, after whitespace is collapsed, the resulting sequence of characters is not in the lexical space defined by the XML Schema integer data type.
These are the pre and post conditions of calling this method:
getElementAsLong in interface TypedXMLStreamReaderXMLStreamException - If unable to access contentTypedXMLStreamException - If unable to convert the resulting
character sequence into a Java (64-bit) integer.public QName getElementAsQName() throws XMLStreamException
getElementAsQName in interface TypedXMLStreamReaderXMLStreamExceptionpublic byte[] getElementAsBinary()
throws XMLStreamException
TypedXMLStreamReaderTypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant), in cases where neither performance nor
memory usage is a big concern.
Note: base64 variant defaults to Base64Variants.MIME.
getElementAsBinary in interface TypedXMLStreamReaderXMLStreamExceptionTypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant)public byte[] getElementAsBinary(Base64Variant v) throws XMLStreamException
TypedXMLStreamReaderTypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant), in cases where neither performance nor
memory usage is a big concern.getElementAsBinary in interface TypedXMLStreamReaderv - Base64 variant content is in; needed to decode
alternative variants ("modified base64")XMLStreamExceptionTypedXMLStreamReader.readElementAsBinary(byte[], int, int, org.codehaus.stax2.typed.Base64Variant)public void getAttributeAs(int index,
TypedValueDecoder tvd)
throws XMLStreamException
TypedXMLStreamReader
As with TypedXMLStreamReader.getElementAs(org.codehaus.stax2.typed.TypedValueDecoder), value passed to a decode
method will be trimmed of any leading or trailing white space.
getAttributeAs in interface TypedXMLStreamReaderXMLStreamExceptionpublic int getAttributeAsArray(int index,
TypedArrayDecoder tad)
throws XMLStreamException
TypedXMLStreamReadergetAttributeAsArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic byte[] getAttributeAsBinary(int index)
throws XMLStreamException
TypedXMLStreamReadergetAttributeAsBinary in interface TypedXMLStreamReaderindex - The attribute's index as returned by TypedXMLStreamReader.getAttributeIndex(String, String).XMLStreamException - If unable to convert the resulting
character sequence into an XML Schema boolean value.public byte[] getAttributeAsBinary(int index,
Base64Variant v)
throws XMLStreamException
getAttributeAsBinary in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsDoubleArray(double[] value,
int from,
int length)
throws XMLStreamException
readElementAsDoubleArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsFloatArray(float[] value,
int from,
int length)
throws XMLStreamException
readElementAsFloatArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsIntArray(int[] value,
int from,
int length)
throws XMLStreamException
TypedXMLStreamReader
<xs:simpleType name="intArray">
<xs:list itemType="xs:int"/>
</xs:simpleType>
whose lexical space is a list of space-separated ints.
Whitespace MUST be
collapsed
according to the whiteSpace facet for the intArray
type shown above. An exception is thrown if, after whitespace is
collapsed, the resulting sequence of characters is not in
the lexical space defined by the intArray data
type.
These are the pre and post conditions of calling this method:
readElementAsIntArray in interface TypedXMLStreamReadervalue - The array in which to copy the ints.from - The index in the array from which copying starts.length - The maximun number of ints to copy. Minimum value
is 1; others an IllegalArgumentException is thrownlength, but
at least one if any ints found. If not, -1 is returned
to signal end of ints to parse.XMLStreamExceptionpublic int readElementAsLongArray(long[] value,
int from,
int length)
throws XMLStreamException
readElementAsLongArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsArray(TypedArrayDecoder tad) throws XMLStreamException
TypedXMLStreamReaderThese are the pre- and post-conditions of calling this method:
Note: passed decoder must accept at least one value, reader will not verify capacity before calling it with the first token.
readElementAsArray in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength)
throws XMLStreamException
readElementAsBinary in interface TypedXMLStreamReaderXMLStreamExceptionpublic int readElementAsBinary(byte[] resultBuffer,
int offset,
int maxLength,
Base64Variant v)
throws XMLStreamException
TypedXMLStreamReaderEach call will read at least one decoded byte (and no more than the specified maximum length), if there is any content remaining. If none is available and END_ELEMENT is encountered, -1 is returned.
These are the pre and post conditions of calling this method:
Additionally, caller MUST start decoding at START_ELEMENT; if the first decode calls is at CHARACTERS or CDATA event, results are not defined: result may be an exception, or invalid data being returned. Implementations are encouraged to throw an exception if possible, to make it easier to figure out the problem.
This method can be called multiple times until the cursor is positioned at the corresponding END_ELEMENT event. Stated differently, after the method is called for the first time, the cursor will move and remain in the CHARACTERS position while there are potentially more bytes available for reading.
readElementAsBinary in interface TypedXMLStreamReaderresultBuffer - Array in which to copy decoded bytes.offset - Starting offset of the first decoded byte
within result buffermaxLength - Maximun number of bytes to decode with this callmaxLength
Note that this value is not guaranteed to equal maxLength
even if enough content was available; that is, implementations
can return shorter sections if they choose to, down to and including
returning zero (0) if it was not possible to decode a full base64
triplet (3 output bytes from 4 input characters).XMLStreamExceptionCopyright © 2015 fasterxml.com. All Rights Reserved.