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 int
bufferSize()
void
close()
List<XMLEvent>
getBuffer()
boolean
hasNext()
protected XMLEvent
internalNextEvent()
Subclass's version ofBaseXMLEventReader.nextEvent()
, called byBaseXMLEventReader.next()
void
mark()
Same as callingmark(int)
with -1.void
mark(int eventLimit)
Start buffering eventsXMLEvent
peek()
void
remove()
If reading from the buffer after areset()
call anIllegalStateException
will be thrown.void
reset()
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:BaseXMLEventReader
Subclass's version ofBaseXMLEventReader.nextEvent()
, called byBaseXMLEventReader.next()
- Specified by:
internalNextEvent
in classBaseXMLEventReader
- Throws:
XMLStreamException
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<Object>
- Specified by:
hasNext
in interfaceXMLEventReader
- Overrides:
hasNext
in classEventReaderDelegate
-
peek
public XMLEvent peek() throws XMLStreamException
- Specified by:
peek
in interfaceXMLEventReader
- Overrides:
peek
in 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:
close
in interfaceXMLEventReader
- Overrides:
close
in 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 anIllegalStateException
will be thrown.- Specified by:
remove
in interfaceIterator<Object>
- Overrides:
remove
in classEventReaderDelegate
-
-