Class ResettableXmlEventReader
java.lang.Object
com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
com.atlassian.confluence.content.render.xhtml.ResettableXmlEventReader
- All Implemented Interfaces:
Iterator<Object>
,XMLEventReader
Not thread-safe. Ensure each instance of this is restricted to being used in one thread only.
-
Field Summary
Fields inherited from class com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
delegate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns an integer which represents the position of the current event in the event stream.boolean
hasNext()
next()
nextTag()
peek()
void
remove()
reset()
Resets this reader back to its original state before any events have been consumed through methods likenextEvent()
ornext()
.void
restoreEventPosition
(int position) Moves the pointer of this reader to the specified position.toString()
Methods inherited from class com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
close, getProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ResettableXmlEventReader
-
-
Method Details
-
reset
Resets this reader back to its original state before any events have been consumed through methods likenextEvent()
ornext()
.- Returns:
- the current instance of the xml event reader with event position restored to the start (i.e. 0).
-
nextEvent
- Specified by:
nextEvent
in interfaceXMLEventReader
- Overrides:
nextEvent
in classForwardingXmlEventReader
- Throws:
XMLStreamException
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<Object>
- Specified by:
hasNext
in interfaceXMLEventReader
- Overrides:
hasNext
in classForwardingXmlEventReader
-
peek
- Specified by:
peek
in interfaceXMLEventReader
- Overrides:
peek
in classForwardingXmlEventReader
- Throws:
XMLStreamException
-
getCurrentEventPosition
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 bypeek()
ornextEvent()
.- Returns:
- an integer which represents the position of the current event in the event stream.
-
restoreEventPosition
public void restoreEventPosition(int position) Moves the pointer of this reader to the specified position. The position specified should be retrieved viagetCurrentEventPosition()
. 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
-
getElementText
- Specified by:
getElementText
in interfaceXMLEventReader
- Overrides:
getElementText
in classForwardingXmlEventReader
- Throws:
XMLStreamException
-
nextTag
- Specified by:
nextTag
in interfaceXMLEventReader
- Overrides:
nextTag
in classForwardingXmlEventReader
- Throws:
XMLStreamException
-
next
- Specified by:
next
in interfaceIterator<Object>
- Overrides:
next
in classForwardingXmlEventReader
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<Object>
- Overrides:
remove
in classForwardingXmlEventReader
-
toString
-