public class Stax2EventReaderAdapter extends Object implements XMLEventReader2
XMLEventReader2, the
 extended stream reader defined by Stax2 extension, by wrapping
 a vanilla Stax 1.0 XMLEventReader implementation.
Note: the implementation may be incomplete as-is, since not all features needed are necessarily accessible via basic Stax 1.0 interface. As such, two main use cases for this wrapper are:
| Modifier | Constructor and Description | 
|---|---|
protected  | 
Stax2EventReaderAdapter(XMLEventReader er)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()  | 
String | 
getElementText()  | 
Object | 
getProperty(String name)  | 
boolean | 
hasNext()  | 
boolean | 
hasNextEvent()
Method that is similar to  
XMLEventReader.hasNext(), except that it can
 throw a XMLStreamException. | 
boolean | 
isPropertySupported(String name)
Method similar to  
XMLInputFactory.isPropertySupported(java.lang.String), used
 to determine whether a property is supported by the Reader
 instance. | 
Object | 
next()  | 
XMLEvent | 
nextEvent()  | 
XMLEvent | 
nextTag()  | 
XMLEvent | 
peek()  | 
void | 
remove()
Note: only here because we implement Iterator interface. 
 | 
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. | 
static XMLEventReader2 | 
wrapIfNecessary(XMLEventReader er)
Method that should be used to add dynamic support for
  
XMLEventReader2. | 
protected Stax2EventReaderAdapter(XMLEventReader er)
public static XMLEventReader2 wrapIfNecessary(XMLEventReader er)
XMLEventReader2. Method will check whether the
 stream reader passed happens to be a XMLEventReader2;
 and if it is, return it properly cast. If not, it will create
 necessary wrapper.public void close()
           throws XMLStreamException
close in interface XMLEventReaderXMLStreamExceptionpublic String getElementText() throws XMLStreamException
getElementText in interface XMLEventReaderXMLStreamExceptionpublic Object getProperty(String name)
getProperty in interface XMLEventReaderpublic boolean hasNext()
hasNext in interface IteratorhasNext in interface XMLEventReaderpublic XMLEvent nextEvent() throws XMLStreamException
nextEvent in interface XMLEventReaderXMLStreamExceptionpublic XMLEvent nextTag() throws XMLStreamException
nextTag in interface XMLEventReaderXMLStreamExceptionpublic XMLEvent peek() throws XMLStreamException
peek in interface XMLEventReaderXMLStreamExceptionpublic void remove()
public boolean hasNextEvent()
                     throws XMLStreamException
XMLEventReader2XMLEventReader.hasNext(), except that it can
 throw a XMLStreamException. This is important distinction,
 since the underlying stream reader is NOT allowed to throw such an
 exception when its
 hasNext() gets called; but the underlying parser
 may well need to advance the input stream and in doing so may
 encounter an exception. This exception should be propagated to
 the caller, as it may signal a problem with the input stream
 or xml content.hasNextEvent in interface XMLEventReader2XMLStreamExceptionpublic boolean isPropertySupported(String name)
XMLEventReader2XMLInputFactory.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 XMLEventReader2public boolean setProperty(String name, Object value)
XMLEventReader2XMLInputFactory2
 instance. Exactly which methods are mutable is implementation
 specific.setProperty in interface XMLEventReader2name - Name of the property to setvalue - Value to set property to.Copyright © 2015 fasterxml.com. All Rights Reserved.