public class Stax2FilteredEventReader extends java.lang.Object implements XMLEventReader2, javax.xml.stream.XMLStreamConstants
Some notes about implemention:
| Modifier and Type | Field and Description |
|---|---|
(package private) javax.xml.stream.EventFilter |
mFilter |
(package private) XMLEventReader2 |
mReader |
| Constructor and Description |
|---|
Stax2FilteredEventReader(XMLEventReader2 r,
javax.xml.stream.EventFilter f) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
java.lang.String |
getElementText() |
java.lang.Object |
getProperty(java.lang.String name) |
boolean |
hasNext() |
boolean |
hasNextEvent()
Method that is similar to
XMLEventReader.hasNext(), except that it can
throw a XMLStreamException. |
boolean |
isPropertySupported(java.lang.String name)
Method similar to
XMLInputFactory.isPropertySupported(java.lang.String), used
to determine whether a property is supported by the Reader
instance. |
java.lang.Object |
next() |
javax.xml.stream.events.XMLEvent |
nextEvent() |
javax.xml.stream.events.XMLEvent |
nextTag() |
javax.xml.stream.events.XMLEvent |
peek()
This is bit tricky to implement, but it should filter out
events just as nextEvent() would.
|
void |
remove()
Note: only here because we implement Iterator interface
|
boolean |
setProperty(java.lang.String name,
java.lang.Object value)
Method that can be used to set per-reader properties; a subset of
properties one can set via matching
XMLInputFactory2
instance. |
final XMLEventReader2 mReader
final javax.xml.stream.EventFilter mFilter
public Stax2FilteredEventReader(XMLEventReader2 r, javax.xml.stream.EventFilter f)
public void close()
throws javax.xml.stream.XMLStreamException
close in interface javax.xml.stream.XMLEventReaderjavax.xml.stream.XMLStreamExceptionpublic java.lang.String getElementText()
throws javax.xml.stream.XMLStreamException
getElementText in interface javax.xml.stream.XMLEventReaderjavax.xml.stream.XMLStreamExceptionpublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface javax.xml.stream.XMLEventReaderpublic boolean hasNext()
hasNext in interface java.util.IteratorhasNext in interface javax.xml.stream.XMLEventReaderpublic javax.xml.stream.events.XMLEvent nextEvent()
throws javax.xml.stream.XMLStreamException
nextEvent in interface javax.xml.stream.XMLEventReaderjavax.xml.stream.XMLStreamExceptionpublic java.lang.Object next()
next in interface java.util.Iteratorpublic javax.xml.stream.events.XMLEvent nextTag()
throws javax.xml.stream.XMLStreamException
nextTag in interface javax.xml.stream.XMLEventReaderjavax.xml.stream.XMLStreamExceptionpublic javax.xml.stream.events.XMLEvent peek()
throws javax.xml.stream.XMLStreamException
peek in interface javax.xml.stream.XMLEventReaderjavax.xml.stream.XMLStreamExceptionpublic void remove()
remove in interface java.util.Iteratorpublic boolean hasNextEvent()
throws javax.xml.stream.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 XMLEventReader2javax.xml.stream.XMLStreamExceptionpublic boolean isPropertySupported(java.lang.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(java.lang.String name,
java.lang.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.