com.atlassian.confluence.content.render.xhtml
Class ResettableXmlEventReader
java.lang.Object
com.atlassian.confluence.content.render.xhtml.ForwardingXmlEventReader
com.atlassian.confluence.content.render.xhtml.ResettableXmlEventReader
- All Implemented Interfaces:
- java.util.Iterator, javax.xml.stream.XMLEventReader
public class ResettableXmlEventReader
- extends ForwardingXmlEventReader
Not thread-safe. Ensure each instance of this is restricted to being used in one thread only.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ResettableXmlEventReader
public ResettableXmlEventReader(javax.xml.stream.XMLEventReader delegate)
reset
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).
nextEvent
public javax.xml.stream.events.XMLEvent nextEvent()
throws javax.xml.stream.XMLStreamException
- Specified by:
nextEvent
in interface javax.xml.stream.XMLEventReader
- Overrides:
nextEvent
in class ForwardingXmlEventReader
- Throws:
javax.xml.stream.XMLStreamException
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
- Specified by:
hasNext
in interface javax.xml.stream.XMLEventReader
- Overrides:
hasNext
in class ForwardingXmlEventReader
peek
public javax.xml.stream.events.XMLEvent peek()
throws javax.xml.stream.XMLStreamException
- Specified by:
peek
in interface javax.xml.stream.XMLEventReader
- Overrides:
peek
in class ForwardingXmlEventReader
- Throws:
javax.xml.stream.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 by
peek()
or nextEvent()
.
- 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 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:
java.lang.IllegalArgumentException
- if pointer is less than zero
getElementText
public java.lang.String getElementText()
throws javax.xml.stream.XMLStreamException
- Specified by:
getElementText
in interface javax.xml.stream.XMLEventReader
- Overrides:
getElementText
in class ForwardingXmlEventReader
- Throws:
javax.xml.stream.XMLStreamException
nextTag
public javax.xml.stream.events.XMLEvent nextTag()
throws javax.xml.stream.XMLStreamException
- Specified by:
nextTag
in interface javax.xml.stream.XMLEventReader
- Overrides:
nextTag
in class ForwardingXmlEventReader
- Throws:
javax.xml.stream.XMLStreamException
next
public java.lang.Object next()
- Specified by:
next
in interface java.util.Iterator
- Overrides:
next
in class ForwardingXmlEventReader
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator
- Overrides:
remove
in class ForwardingXmlEventReader
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2003-2014 Atlassian. All Rights Reserved.