public class

ResettableXmlEventReader

extends ForwardingXmlEventReader
java.lang.Object
   ↳ com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
     ↳ com.atlassian.confluence.content.render.xhtml.ResettableXmlEventReader

Class Overview

Not thread-safe. Ensure each instance of this is restricted to being used in one thread only.

Summary

[Expand]
Inherited Fields
From class com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
Public Constructors
ResettableXmlEventReader(XMLEventReader delegate)
Public Methods
int getCurrentEventPosition()
Returns an integer which represents the position of the current event in the event stream.
String getElementText()
boolean hasNext()
Object next()
XMLEvent nextEvent()
XMLEvent nextTag()
XMLEvent peek()
void remove()
ResettableXmlEventReader reset()
Resets this reader back to its original state before any events have been consumed through methods like nextEvent() or next().
void restoreEventPosition(int position)
Moves the pointer of this reader to the specified position.
[Expand]
Inherited Methods
From class com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
From class java.lang.Object
From interface java.util.Iterator
From interface javax.xml.stream.XMLEventReader

Public Constructors

public ResettableXmlEventReader (XMLEventReader delegate)

Public Methods

public int getCurrentEventPosition ()

Returns an integer which represents the position of the current event in the event stream. The definition of "current event" is the event that will be served by peek() or nextEvent().

Returns
  • an integer which represents the position of the current event in the event stream.

public String getElementText ()

Throws
XMLStreamException

public boolean hasNext ()

public Object next ()

public XMLEvent nextEvent ()

Throws
XMLStreamException

public XMLEvent nextTag ()

Throws
XMLStreamException

public XMLEvent peek ()

Throws
XMLStreamException

public void remove ()

public ResettableXmlEventReader reset ()

Resets this reader back to its original state before any events have been consumed through methods like nextEvent() or next().

Returns
  • the current instance of the xml event reader with event position restored to the start (i.e. 0).

public void restoreEventPosition (int position)

Moves the pointer of this reader to the specified position. The position specified should be retrieved via getCurrentEventPosition(). This method is intended to allow clients to move the pointer back to an earlier position in the stream.

Its not meant for fast forwarding - attempting to set a pointer higher than the number of events read from this reader will just result in stream will be served out as per normal.

Parameters
position an integer representing the position of an event in an event stream
Throws
IllegalArgumentException if pointer is less than zero