public synchronized XMLEvent peek() throws XMLStreamException { if (closed) { throw new XMLStreamException("Stream has been closed"); } if (nextEvent == null) { nextEvent = allocateEvent(); reader.next(); } return nextEvent; }
public synchronized XMLEvent nextEvent() throws XMLStreamException { if (closed) { throw new XMLStreamException("Stream has been closed"); } XMLEvent event; if (nextEvent != null) { event = nextEvent; nextEvent = null; } else { event = allocateEvent(); reader.next(); } return event; }