Package org.springframework.batch.item.xml.stax

# Class DefaultFragmentEventReader

java.lang.Object
org.springframework.batch.item.xml.stax.DefaultFragmentEventReader

All Implemented Interfaces:
  `Iterator<Object>`, `XMLEventReader`, `FragmentEventReader`

public class DefaultFragmentEventReader extends Object implements FragmentEventReader
Default implementation of `FragmentEventReader`

Author:
  Robert Kasanicky

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected XMLEventReader`
  `wrappedEventReader`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultFragmentEventReader(XMLEventReader wrappedEventReader)`
  Caches the StartDocument event for later use.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `String`
  `getElementText()`
  `Object`
  `getProperty(String name)`
  `boolean`
  `hasNext()`
  `void`
  `markFragmentProcessed()`
  Finishes reading the fragment in case the fragment was processed without being read until the end.
  `void`
  `markStartFragment()`
  Tells the event reader its cursor position is exactly before the fragment.
  `Object`
  `next()`
  `XMLEvent`
  `nextEvent()`
  `XMLEvent`
  `nextTag()`
  `XMLEvent`
  `peek()`
  `void`
  `remove()`
  `void`
  `reset()`
  Reset the state of the fragment reader - make it forget it assumptions about current position of cursor (e.g.

  ### 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, remove`

  ### Methods inherited from interface javax.xml.stream.XMLEventReader

  `close, getElementText, getProperty, nextTag`

- ## Field Details

  - ### wrappedEventReader

    protected XMLEventReader wrappedEventReader

- ## Constructor Details

  - ### DefaultFragmentEventReader

    public DefaultFragmentEventReader(XMLEventReader wrappedEventReader)
    Caches the StartDocument event for later use.
    Parameters:
      `wrappedEventReader` - the original wrapped event reader

- ## Method Details

  - ### markStartFragment

    public void markStartFragment()
    Description copied from interface: `FragmentEventReader`
    Tells the event reader its cursor position is exactly before the fragment.
    Specified by:
      `markStartFragment` in interface `FragmentEventReader`

  - ### hasNext

    public boolean hasNext()
    Specified by:
      `hasNext` in interface `Iterator<Object>`
    Specified by:
      `hasNext` in interface `XMLEventReader`

  - ### next

    public Object next()
    Specified by:
      `next` in interface `Iterator<Object>`

  - ### nextEvent

    public XMLEvent nextEvent() throws XMLStreamException
    Specified by:
      `nextEvent` in interface `XMLEventReader`
    Throws:
      `XMLStreamException`

  - ### peek

    public XMLEvent peek() throws XMLStreamException
    Specified by:
      `peek` in interface `XMLEventReader`
    Throws:
      `XMLStreamException`

  - ### markFragmentProcessed

    public void markFragmentProcessed()
    Finishes reading the fragment in case the fragment was processed without being read until the end.
    Specified by:
      `markFragmentProcessed` in interface `FragmentEventReader`

  - ### reset

    public void reset()
    Description copied from interface: `FragmentEventReader`
    Reset the state of the fragment reader - make it forget it assumptions about current position of cursor (e.g. in case of rollback of the wrapped reader).
    Specified by:
      `reset` in interface `FragmentEventReader`

  - ### close

    public void close() throws XMLStreamException
    Specified by:
      `close` in interface `XMLEventReader`
    Throws:
      `XMLStreamException`

  - ### getElementText

    public String getElementText() throws XMLStreamException
    Specified by:
      `getElementText` in interface `XMLEventReader`
    Throws:
      `XMLStreamException`

  - ### getProperty

    public Object getProperty(String name) throws IllegalArgumentException
    Specified by:
      `getProperty` in interface `XMLEventReader`
    Throws:
      `IllegalArgumentException`

  - ### nextTag

    public XMLEvent nextTag() throws XMLStreamException
    Specified by:
      `nextTag` in interface `XMLEventReader`
    Throws:
      `XMLStreamException`

  - ### remove

    public void remove()
    Specified by:
      `remove` in interface `Iterator<Object>`