APIdia Launch Partner
Top Description Fields Constructors Methods
javax.xml.stream.util

public Class EventReaderDelegate

extends Object
implements XMLEventReader
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLEventReader, java.util.Iterator
Known Direct Subclasses
com.sun.xml.internal.stream.EventFilterSupport
Imports
javax.xml.stream.XMLEventReader, .XMLStreamException, javax.xml.stream.events.XMLEvent

This is the base class for deriving an XMLEventReader filter. This class is designed to sit between an XMLEventReader and an application's XMLEventReader. By default each method does nothing but call the corresponding method on the parent interface.
Author
Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
Since
1.6
Version
1.0
See Also
javax.xml.stream.XMLEventReader, StreamReaderDelegate

Field Summary

Modifier and TypeField and Description
private XMLEventReader

Constructor Summary

AccessConstructor and Description
public
EventReaderDelegate()

Construct an empty filter with no parent.

public
EventReaderDelegate(XMLEventReader
the parent
reader
)

Construct an filter with the specified parent.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements javax.xml.stream.XMLEventReader.close.

Frees any resources associated with this Reader.

public String
getElementText()

Implements javax.xml.stream.XMLEventReader.getElementText.

Reads the content of a text-only element.

public XMLEventReader

Returns:

the parent or null if none is set
getParent
()

Get the parent of this instance.

public Object
getProperty(String name)

Implements javax.xml.stream.XMLEventReader.getProperty.

Get the value of a feature/property from the underlying implementation

public boolean
hasNext()

Implements javax.xml.stream.XMLEventReader.hasNext.

Check if there are more events.

public Object
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public XMLEvent
nextEvent()

Implements javax.xml.stream.XMLEventReader.nextEvent.

Gets the next XMLEvent.

public XMLEvent
nextTag()

Implements javax.xml.stream.XMLEventReader.nextTag.

Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.

public XMLEvent
peek()

Implements javax.xml.stream.XMLEventReader.peek.

Check the next XMLEvent without reading it from the stream.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

public void
setParent(XMLEventReader
the new parent
reader
)

Set the parent of this instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

readerback to summary
private XMLEventReader reader

Constructor Detail

EventReaderDelegateback to summary
public EventReaderDelegate()

Construct an empty filter with no parent.

EventReaderDelegateback to summary
public EventReaderDelegate(XMLEventReader reader)

Construct an filter with the specified parent.

Parameters
reader:XMLEventReader

the parent

Method Detail

closeback to summary
public void close() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.close.

Doc from javax.xml.stream.XMLEventReader.close.

Frees any resources associated with this Reader. This method does not close the underlying input source.

Exceptions
XMLStreamException:
if there are errors freeing associated resources
getElementTextback to summary
public String getElementText() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.getElementText.

Doc from javax.xml.stream.XMLEventReader.getElementText.

Reads the content of a text-only element.

Precondition

the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.

Exceptions
XMLStreamException:
if the current event is not a START_ELEMENT or if a non text element is encountered
getParentback to summary
public XMLEventReader getParent()

Get the parent of this instance.

Returns:XMLEventReader

the parent or null if none is set

getPropertyback to summary
public Object getProperty(String name) throws IllegalArgumentException

Implements javax.xml.stream.XMLEventReader.getProperty.

Doc from javax.xml.stream.XMLEventReader.getProperty.

Get the value of a feature/property from the underlying implementation

Exceptions
IllegalArgumentException:
if the property is not supported
hasNextback to summary
public boolean hasNext()

Implements javax.xml.stream.XMLEventReader.hasNext.

Doc from javax.xml.stream.XMLEventReader.hasNext.

Check if there are more events. Returns true if there are more events and false otherwise.

nextback to summary
public Object next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

nextEventback to summary
public XMLEvent nextEvent() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.nextEvent.

Doc from javax.xml.stream.XMLEventReader.nextEvent.

Gets the next XMLEvent. The initial event is StartDocument.

Exceptions
XMLStreamException:
if there is an error with the underlying XML.
nextTagback to summary
public XMLEvent nextTag() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.nextTag.

Doc from javax.xml.stream.XMLEventReader.nextTag.

Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached. If anything other than space characters are encountered, an exception is thrown. This method should be used when processing element-only content because the parser is not able to recognize ignorable whitespace if the DTD is missing or not interpreted.

Exceptions
XMLStreamException:
if anything other than space characters are encountered
peekback to summary
public XMLEvent peek() throws XMLStreamException

Implements javax.xml.stream.XMLEventReader.peek.

Doc from javax.xml.stream.XMLEventReader.peek.

Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents. A call to peek() will be equal to the next return of next().

Exceptions
XMLStreamException:
if an error occurs
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

setParentback to summary
public void setParent(XMLEventReader reader)

Set the parent of this instance.

Parameters
reader:XMLEventReader

the new parent