org.springframework.batch.item.xml.stax

## Class DefaultFragmentEventReader

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

- All Implemented Interfaces:
    java.util.Iterator, javax.xml.stream.XMLEventReader, FragmentEventReader

      public class DefaultFragmentEventReader
      extends java.lang.Object
      implements FragmentEventReader

  Default implementation of `FragmentEventReader`
  Author:
    Robert Kasanicky

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.xml.stream.XMLEventReader` | `wrappedEventReader`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `java.lang.String` | `getElementText()`
    `java.lang.Object` | `getProperty(java.lang.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.
    `java.lang.Object` | `next()`
    `javax.xml.stream.events.XMLEvent` | `nextEvent()`
    `javax.xml.stream.events.XMLEvent` | `nextTag()`
    `javax.xml.stream.events.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 javax.xml.stream.XMLEventReader

      `close, getElementText, getProperty, nextTag`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, remove`

- - ### Field Detail

    - #### wrappedEventReader

          protected javax.xml.stream.XMLEventReader wrappedEventReader

  - ### Constructor Detail

    - #### DefaultFragmentEventReader

          public DefaultFragmentEventReader(javax.xml.stream.XMLEventReader wrappedEventReader)

      Caches the StartDocument event for later use.
      Parameters:
        `wrappedEventReader` - the original wrapped event reader

  - ### Method Detail

    - #### 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 `java.util.Iterator`
      Specified by:
        `hasNext` in interface `javax.xml.stream.XMLEventReader`

    - #### next

          public java.lang.Object next()

      Specified by:
        `next` in interface `java.util.Iterator`

    - #### nextEvent

          public javax.xml.stream.events.XMLEvent nextEvent()
                                                     throws javax.xml.stream.XMLStreamException

      Specified by:
        `nextEvent` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### peek

          public javax.xml.stream.events.XMLEvent peek()
                                                throws javax.xml.stream.XMLStreamException

      Specified by:
        `peek` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `javax.xml.stream.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 javax.xml.stream.XMLStreamException

      Specified by:
        `close` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### getElementText

          public java.lang.String getElementText()
                                          throws javax.xml.stream.XMLStreamException

      Specified by:
        `getElementText` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### getProperty

          public java.lang.Object getProperty(java.lang.String name)
                                       throws java.lang.IllegalArgumentException

      Specified by:
        `getProperty` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `java.lang.IllegalArgumentException`

    - #### nextTag

          public javax.xml.stream.events.XMLEvent nextTag()
                                                   throws javax.xml.stream.XMLStreamException

      Specified by:
        `nextTag` in interface `javax.xml.stream.XMLEventReader`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `java.util.Iterator`