|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper
org.apache.axiom.util.stax.xop.XOPDecodingStreamReader
public class XOPDecodingStreamReader
XMLStreamReader wrapper that decodes XOP. It uses the extension defined by
DataHandlerReader to expose the DataHandler objects referenced by
xop:Include elements encountered in the underlying stream. If the consumer uses
getText(), getTextCharacters(),
getTextCharacters(int, char[], int, int) or getElementText() when an
xop:Include element is present in the underlying stream, then the decoder will produce
a base64 representation of the data.
Note that this class only implements infoset transformation, but doesn't handle MIME processing.
A MimePartProvider implementation must be provided to the constructor of this class. This
object will be used to load MIME parts referenced by xop:Include elements encountered
in the underlying stream.
This class supports deferred loading of MIME parts: If the consumer uses
DataHandlerReader.getDataHandlerProvider(), then the MimePartProvider will only
be invoked when DataHandlerProvider.getDataHandler() is called.
| Field Summary |
|---|
| Fields inherited from interface org.apache.axiom.ext.stax.datahandler.DataHandlerReader |
|---|
PROPERTY |
| 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 | |
|---|---|
XOPDecodingStreamReader(XMLStreamReader parent,
MimePartProvider mimePartProvider)
Constructor. |
|
| Method Summary | |
|---|---|
String |
getContentID()
Get the content ID of the binary content for the current event, if available. |
DataHandler |
getDataHandler()
Get the DataHandler with the binary content for the current event. |
DataHandlerProvider |
getDataHandlerProvider()
Get a DataHandlerProvider instance for deferred loading of the binary content for the
current event. |
String |
getElementText()
|
int |
getEventType()
|
String |
getLocalName()
|
Location |
getLocation()
|
QName |
getName()
|
int |
getNamespaceCount()
|
String |
getNamespacePrefix(int index)
|
String |
getNamespaceURI()
|
String |
getNamespaceURI(int index)
|
String |
getNamespaceURI(String prefix)
|
String |
getPrefix()
|
Object |
getProperty(String name)
|
String |
getText()
|
char[] |
getTextCharacters()
|
int |
getTextCharacters(int sourceStart,
char[] target,
int targetStart,
int length)
|
int |
getTextLength()
|
int |
getTextStart()
|
boolean |
hasName()
|
boolean |
hasText()
|
boolean |
isBinary()
Check whether the current event is a XMLStreamConstants.CHARACTERS
event representing base64 encoded binary content and for which a
DataHandler is available. |
boolean |
isCharacters()
|
boolean |
isDeferred()
Check whether the XMLStreamReader supports deferred loading of the
binary content for the current event. |
boolean |
isEndElement()
|
boolean |
isOptimized()
Check if the binary content is eligible for optimization (e.g. using XOP) or if it should be serialized as base64. |
boolean |
isStartElement()
|
boolean |
isWhiteSpace()
|
int |
next()
|
int |
nextTag()
|
void |
require(int type,
String namespaceURI,
String localName)
|
| Methods inherited from class org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper |
|---|
close, getAttributeCount, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getEncoding, getNamespaceContext, getParent, getPIData, getPITarget, getVersion, hasNext, isAttributeSpecified, isStandalone, standaloneSet |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XOPDecodingStreamReader(XMLStreamReader parent,
MimePartProvider mimePartProvider)
parent - the XML stream to decodemimePartProvider - An implementation of the MimePartProvider interface that will be used to
load the DataHandler objects for MIME parts referenced by
xop:Include element information items encountered in the underlying
stream.| Method Detail |
|---|
public int next()
throws XMLStreamException
next in interface XMLStreamReadernext in class XMLStreamReaderWrapperXMLStreamExceptionpublic int getEventType()
getEventType in interface XMLStreamReadergetEventType in class XMLStreamReaderWrapper
public int nextTag()
throws XMLStreamException
nextTag in interface XMLStreamReadernextTag in class XMLStreamReaderWrapperXMLStreamException
public Object getProperty(String name)
throws IllegalArgumentException
getProperty in interface XMLStreamReadergetProperty in class XMLStreamReaderWrapperIllegalArgumentException
public String getElementText()
throws XMLStreamException
getElementText in interface XMLStreamReadergetElementText in class XMLStreamReaderWrapperXMLStreamExceptionpublic String getPrefix()
getPrefix in interface XMLStreamReadergetPrefix in class XMLStreamReaderWrapperpublic String getNamespaceURI()
getNamespaceURI in interface XMLStreamReadergetNamespaceURI in class XMLStreamReaderWrapperpublic String getLocalName()
getLocalName in interface XMLStreamReadergetLocalName in class XMLStreamReaderWrapperpublic QName getName()
getName in interface XMLStreamReadergetName in class XMLStreamReaderWrapperpublic Location getLocation()
getLocation in interface XMLStreamReadergetLocation in class XMLStreamReaderWrapperpublic String getNamespaceURI(String prefix)
getNamespaceURI in interface XMLStreamReadergetNamespaceURI in class XMLStreamReaderWrapperpublic int getNamespaceCount()
getNamespaceCount in interface XMLStreamReadergetNamespaceCount in class XMLStreamReaderWrapperpublic String getNamespacePrefix(int index)
getNamespacePrefix in interface XMLStreamReadergetNamespacePrefix in class XMLStreamReaderWrapperpublic String getNamespaceURI(int index)
getNamespaceURI in interface XMLStreamReadergetNamespaceURI in class XMLStreamReaderWrapperpublic String getText()
getText in interface XMLStreamReadergetText in class XMLStreamReaderWrapperpublic char[] getTextCharacters()
getTextCharacters in interface XMLStreamReadergetTextCharacters in class XMLStreamReaderWrapper
public int getTextCharacters(int sourceStart,
char[] target,
int targetStart,
int length)
throws XMLStreamException
getTextCharacters in interface XMLStreamReadergetTextCharacters in class XMLStreamReaderWrapperXMLStreamExceptionpublic int getTextLength()
getTextLength in interface XMLStreamReadergetTextLength in class XMLStreamReaderWrapperpublic int getTextStart()
getTextStart in interface XMLStreamReadergetTextStart in class XMLStreamReaderWrapperpublic boolean hasText()
hasText in interface XMLStreamReaderhasText in class XMLStreamReaderWrapperpublic boolean isCharacters()
isCharacters in interface XMLStreamReaderisCharacters in class XMLStreamReaderWrapperpublic boolean isStartElement()
isStartElement in interface XMLStreamReaderisStartElement in class XMLStreamReaderWrapperpublic boolean isEndElement()
isEndElement in interface XMLStreamReaderisEndElement in class XMLStreamReaderWrapperpublic boolean hasName()
hasName in interface XMLStreamReaderhasName in class XMLStreamReaderWrapperpublic boolean isWhiteSpace()
isWhiteSpace in interface XMLStreamReaderisWhiteSpace in class XMLStreamReaderWrapper
public void require(int type,
String namespaceURI,
String localName)
throws XMLStreamException
require in interface XMLStreamReaderrequire in class XMLStreamReaderWrapperXMLStreamExceptionpublic boolean isBinary()
DataHandlerReaderXMLStreamConstants.CHARACTERS
event representing base64 encoded binary content and for which a
DataHandler is available.
isBinary in interface DataHandlerReadertrue if the current event is a
XMLStreamConstants.CHARACTERS event representing base64
encoded binary content and for which a DataHandler is
available; false for all other types of events.public boolean isOptimized()
DataHandlerReaderDataHandlerReader.isBinary() returns true for
the current event. The behavior of this method is undefined if this is not the case.
isOptimized in interface DataHandlerReadertrue if the binary content is eligible for optimization;
false otherwisepublic boolean isDeferred()
DataHandlerReaderXMLStreamReader supports deferred loading of the
binary content for the current event. If this method returns true then a
consumer MAY call DataHandlerReader.getDataHandlerProvider() and retrieve the
DataHandler later using DataHandlerProvider.getDataHandler().
Calling this method is only meaningful if DataHandlerReader.isBinary() returns true for
the current event. The behavior of this method is undefined if this is not the case.
isDeferred in interface DataHandlerReadertrue if deferred loading is supported; false otherwisepublic String getContentID()
DataHandlerReaderDataHandlerReader.isBinary() returns true for the
current event.
The implementation SHOULD only return a non null value if the content ID has been used previously in an interaction with another component or system. The implementation SHOULD NOT generate a new content ID solely for the purpose of this method.
If available, the returned value MUST be a raw content ID. In particular:
A consumer MAY use the return value of this method in contexts where it is desirable to preserve the original content ID used by another system or component to identify the binary content. However, the consumer MUST NOT make any assumption about the uniqueness or validity of the content ID (with respect to relevant standards such as RFC822) and SHOULD make provision to sanitize the value if necessary.
getContentID in interface DataHandlerReadernull
if no content ID is known
public DataHandler getDataHandler()
throws XMLStreamException
DataHandlerReaderDataHandler with the binary content for the current event. The behavior of
this method is only defined for events for which DataHandlerReader.isBinary() returns
true. For events of this type the method MUST return a valid
DataHandler, regardless of the return value of DataHandlerReader.isDeferred(). If
DataHandlerReader.isDeferred() returns true, then the consumer may use this method to
force the implementation to load the binary content immediately.
getDataHandler in interface DataHandlerReaderXMLStreamException - if an error occurs while loading the DataHandlerpublic DataHandlerProvider getDataHandlerProvider()
DataHandlerReaderDataHandlerProvider instance for deferred loading of the binary content for the
current event. The behavior of this method is defined if and only if DataHandlerReader.isDeferred()
returns true for the current event. The returned reference MUST remain valid
after the current event has been consumed. It is up to the implementation to specify the
exact lifecycle of the returned instance, in particular until when the binary content can be
retrieved.
getDataHandlerProvider in interface DataHandlerReaderDataHandlerProvider instance the consumer can use to load the binary
content at a later time
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||