javax.xml.stream.util
Class EventReaderDelegate

java.lang.Object
  extended by javax.xml.stream.util.EventReaderDelegate
All Implemented Interfaces:
Iterator, XMLEventReader

public class EventReaderDelegate
extends Object
implements XMLEventReader

Base class for event reader filters.


Constructor Summary
EventReaderDelegate()
          Constructs an empty filter with no parent set.
EventReaderDelegate(XMLEventReader reader)
          Constructs an empty filter with the given parent.
 
Method Summary
 void close()
          Free any resources associated with this parser.
 String getElementText()
          Reads the text context of an element.
 XMLEventReader getParent()
          Returns the parent.
 Object getProperty(String name)
          Returns the implementation-specific feature or property of the given name.
 boolean hasNext()
          Indicates whether there are more XML events to be read.
 Object next()
          Obtain the next element in the collection.
 XMLEvent nextEvent()
          Returns the next XML event.
 XMLEvent nextTag()
          Returns the next element event.
 XMLEvent peek()
          Looks at the next XML event without advancing the cursor in the stream.
 void remove()
          Remove from the underlying collection the last element returned by next (optional operation).
 void setParent(XMLEventReader reader)
          Sets the parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventReaderDelegate

public EventReaderDelegate()
Constructs an empty filter with no parent set.


EventReaderDelegate

public EventReaderDelegate(XMLEventReader reader)
Constructs an empty filter with the given parent.

Method Detail

setParent

public void setParent(XMLEventReader reader)
Sets the parent.


getParent

public XMLEventReader getParent()
Returns the parent.


nextEvent

public XMLEvent nextEvent()
                   throws XMLStreamException
Description copied from interface: XMLEventReader
Returns the next XML event.

Specified by:
nextEvent in interface XMLEventReader
Throws:
XMLStreamException

next

public Object next()
Description copied from interface: Iterator
Obtain the next element in the collection.

Specified by:
next in interface Iterator
Returns:
the next element in the collection

hasNext

public boolean hasNext()
Description copied from interface: XMLEventReader
Indicates whether there are more XML events to be read.

Specified by:
hasNext in interface Iterator
Specified by:
hasNext in interface XMLEventReader
Returns:
true if there is at least one more element in the collection

peek

public XMLEvent peek()
              throws XMLStreamException
Description copied from interface: XMLEventReader
Looks at the next XML event without advancing the cursor in the stream. Returns null if there are no more events to read.

Specified by:
peek in interface XMLEventReader
Throws:
XMLStreamException

getElementText

public String getElementText()
                      throws XMLStreamException
Description copied from interface: XMLEventReader
Reads the text context of an element. When invoked, the current event must be START_ELEMENT. On completion, the current event will be END_ELEMENT.

Specified by:
getElementText in interface XMLEventReader
Throws:
XMLStreamException

nextTag

public XMLEvent nextTag()
                 throws XMLStreamException
Description copied from interface: XMLEventReader
Returns the next element event. This method skips insignificant space until a START_ELEMENT or END_ELEMENT event is found.

Specified by:
nextTag in interface XMLEventReader
Throws:
XMLStreamException - if an event that was not an insignificant space event was encountered

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Description copied from interface: XMLEventReader
Returns the implementation-specific feature or property of the given name.

Specified by:
getProperty in interface XMLEventReader
Throws:
IllegalArgumentException - if the property is not supported

close

public void close()
           throws XMLStreamException
Description copied from interface: XMLEventReader
Free any resources associated with this parser. This method will not close the underlying input source.

Specified by:
close in interface XMLEventReader
Throws:
XMLStreamException

remove

public void remove()
Description copied from interface: Iterator
Remove from the underlying collection the last element returned by next (optional operation). This method can be called only once after each call to next(). It does not affect what will be returned by subsequent calls to next.

Specified by:
remove in interface Iterator