Class BufferedXMLEventReader
- java.lang.Object
-
- javax.xml.stream.util.EventReaderDelegate
-
- org.hibernate.boot.jaxb.internal.stax.BaseXMLEventReader
-
- org.hibernate.boot.jaxb.internal.stax.BufferedXMLEventReader
-
- All Implemented Interfaces:
Iterator<Object>,XMLEventReader
public class BufferedXMLEventReader extends BaseXMLEventReader
Buffers XML events for later re-reading Note, copied from the uPortal project by permission of author. See https://github.com/Jasig/uPortal/blob/master/uportal-war/src/main/java/org/jasig/portal/xml/stream/BufferedXMLEventReader.java
-
-
Constructor Summary
Constructors Constructor Description BufferedXMLEventReader(XMLEventReader reader)Create new buffering reader, no buffering is done untilmark(int)is called.BufferedXMLEventReader(XMLEventReader reader, int eventLimit)Create new buffering reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbufferSize()voidclose()List<XMLEvent>getBuffer()booleanhasNext()protected XMLEventinternalNextEvent()Subclass's version ofBaseXMLEventReader.nextEvent(), called byBaseXMLEventReader.next()voidmark()Same as callingmark(int)with -1.voidmark(int eventLimit)Start buffering eventsXMLEventpeek()voidremove()If reading from the buffer after areset()call anIllegalStateExceptionwill be thrown.voidreset()Reset the reader to these start of the buffered events.-
Methods inherited from class org.hibernate.boot.jaxb.internal.stax.BaseXMLEventReader
getElementText, getPreviousEvent, next, nextEvent, nextTag
-
Methods inherited from class javax.xml.stream.util.EventReaderDelegate
getParent, getProperty, setParent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
BufferedXMLEventReader
public BufferedXMLEventReader(XMLEventReader reader)
Create new buffering reader, no buffering is done untilmark(int)is called.
-
BufferedXMLEventReader
public BufferedXMLEventReader(XMLEventReader reader, int eventLimit)
Create new buffering reader. Callsmark(int)with the specified event limit- See Also:
mark(int)
-
-
Method Detail
-
internalNextEvent
protected XMLEvent internalNextEvent() throws XMLStreamException
Description copied from class:BaseXMLEventReaderSubclass's version ofBaseXMLEventReader.nextEvent(), called byBaseXMLEventReader.next()- Specified by:
internalNextEventin classBaseXMLEventReader- Throws:
XMLStreamException
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<Object>- Specified by:
hasNextin interfaceXMLEventReader- Overrides:
hasNextin classEventReaderDelegate
-
peek
public XMLEvent peek() throws XMLStreamException
- Specified by:
peekin interfaceXMLEventReader- Overrides:
peekin classEventReaderDelegate- Throws:
XMLStreamException
-
mark
public void mark()
Same as callingmark(int)with -1.
-
mark
public void mark(int eventLimit)
Start buffering events- Parameters:
eventLimit- the maximum number of events to buffer. -1 will buffer all events, 0 will buffer no events.
-
reset
public void reset()
Reset the reader to these start of the buffered events.
-
close
public void close() throws XMLStreamException- Specified by:
closein interfaceXMLEventReader- Overrides:
closein classEventReaderDelegate- Throws:
XMLStreamException
-
bufferSize
public int bufferSize()
- Returns:
- The number of events in the buffer.
-
remove
public void remove()
If reading from the buffer after areset()call anIllegalStateExceptionwill be thrown.- Specified by:
removein interfaceIterator<Object>- Overrides:
removein classEventReaderDelegate
-
-