public class XOPEncodingStreamReader extends XOPEncodingStreamWrapper implements XMLStreamReader
XMLStreamReader wrapper that encodes XOP. It assumes that the underlying reader
implements the extension defined by DataHandlerReader so that it can identify the
information items to optimize (by looking for
XMLStreamConstants.CHARACTERS events for which
DataHandlerReader.isBinary() returns true). The DataHandler
objects for the parts referenced by xop:Include element information items produced by
an instance of this class can be retrieved using the XOPEncodingStreamWrapper.getDataHandler(String) method.
Note that the primary purpose of this class is not to serialize an XML infoset to an XOP package
(this is better done using XOPEncodingStreamWriter), but rather to optimize interaction
(by exchanging DataHandler objects instead of base64 encoded representations) with
databinding frameworks that understand XOP, but that are not aware of the
DataHandlerReader extension.
This class defers loading of DataHandler objects until XOPEncodingStreamWrapper.getDataHandler(String) is
called, except if this is not supported by the underlying stream.
ATTRIBUTE, 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 |
|---|
XOPEncodingStreamReader(XMLStreamReader parent,
ContentIDGenerator contentIDGenerator,
OptimizationPolicy optimizationPolicy)
Constructor.
|
getContentIDs, getDataHandler, isLoaded, processDataHandler, processDataHandlerpublic XOPEncodingStreamReader(XMLStreamReader parent, ContentIDGenerator contentIDGenerator, OptimizationPolicy optimizationPolicy)
parent - The XML stream to encode. The reader must implement the extension defined by
DataHandlerReader.contentIDGenerator - used to generate content IDs for the binary content exposed as
xop:Include element information itemsoptimizationPolicy - the policy to apply to decide which binary content to optimizeIllegalArgumentException - if the provided XMLStreamReader doesn't implement the extension defined
by DataHandlerReaderpublic int next()
throws XMLStreamException
next in interface XMLStreamReaderXMLStreamExceptionpublic boolean hasNext()
throws XMLStreamException
hasNext in interface XMLStreamReaderXMLStreamExceptionpublic int nextTag()
throws XMLStreamException
nextTag in interface XMLStreamReaderXMLStreamExceptionpublic void require(int type,
String namespaceURI,
String localName)
throws XMLStreamException
require in interface XMLStreamReaderXMLStreamExceptionpublic Location getLocation()
getLocation in interface XMLStreamReaderpublic void close()
throws XMLStreamException
close in interface XMLStreamReaderXMLStreamExceptionpublic Object getProperty(String name) throws IllegalArgumentException
getProperty in interface XMLStreamReaderIllegalArgumentExceptionpublic String getEncoding()
getEncoding in interface XMLStreamReaderpublic String getCharacterEncodingScheme()
getCharacterEncodingScheme in interface XMLStreamReaderpublic String getVersion()
getVersion in interface XMLStreamReaderpublic boolean isStandalone()
isStandalone in interface XMLStreamReaderpublic boolean standaloneSet()
standaloneSet in interface XMLStreamReaderpublic String getPIData()
getPIData in interface XMLStreamReaderpublic String getPITarget()
getPITarget in interface XMLStreamReaderpublic int getAttributeCount()
getAttributeCount in interface XMLStreamReaderpublic String getAttributeLocalName(int index)
getAttributeLocalName in interface XMLStreamReaderpublic QName getAttributeName(int index)
getAttributeName in interface XMLStreamReaderpublic String getAttributeNamespace(int index)
getAttributeNamespace in interface XMLStreamReaderpublic String getAttributePrefix(int index)
getAttributePrefix in interface XMLStreamReaderpublic String getAttributeType(int index)
getAttributeType in interface XMLStreamReaderpublic String getAttributeValue(int index)
getAttributeValue in interface XMLStreamReaderpublic boolean isAttributeSpecified(int index)
isAttributeSpecified in interface XMLStreamReaderpublic String getAttributeValue(String namespaceURI, String localName)
getAttributeValue in interface XMLStreamReaderpublic String getElementText() throws XMLStreamException
getElementText in interface XMLStreamReaderXMLStreamExceptionpublic int getEventType()
getEventType in interface XMLStreamReaderpublic String getNamespaceURI()
getNamespaceURI in interface XMLStreamReaderpublic String getLocalName()
getLocalName in interface XMLStreamReaderpublic String getPrefix()
getPrefix in interface XMLStreamReaderpublic QName getName()
getName in interface XMLStreamReaderpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamReaderpublic String getNamespaceURI(String prefix)
getNamespaceURI in interface XMLStreamReaderpublic int getNamespaceCount()
getNamespaceCount in interface XMLStreamReaderpublic String getNamespacePrefix(int index)
getNamespacePrefix in interface XMLStreamReaderpublic String getNamespaceURI(int index)
getNamespaceURI in interface XMLStreamReaderpublic String getText()
getText in interface XMLStreamReaderpublic int getTextStart()
getTextStart in interface XMLStreamReaderpublic int getTextLength()
getTextLength in interface XMLStreamReaderpublic char[] getTextCharacters()
getTextCharacters in interface XMLStreamReaderpublic int getTextCharacters(int sourceStart,
char[] target,
int targetStart,
int length)
throws XMLStreamException
getTextCharacters in interface XMLStreamReaderXMLStreamExceptionpublic boolean hasName()
hasName in interface XMLStreamReaderpublic boolean hasText()
hasText in interface XMLStreamReaderpublic boolean isCharacters()
isCharacters in interface XMLStreamReaderpublic boolean isWhiteSpace()
isWhiteSpace in interface XMLStreamReaderpublic boolean isStartElement()
isStartElement in interface XMLStreamReaderpublic boolean isEndElement()
isEndElement in interface XMLStreamReaderCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.