Class ByteArrayXmlStreamReader

java.lang.Object
javax.xml.stream.util.StreamReaderDelegate
io.micronaut.xml.jackson.server.convert.ByteArrayXmlStreamReader
All Implemented Interfaces:
AutoCloseable, XMLStreamConstants, XMLStreamReader

@Internal public final class ByteArrayXmlStreamReader extends StreamReaderDelegate implements AutoCloseable
Stream reader that pairs xml stream with underlying byte array.
Since:
1.0.0
Author:
Sergey Vishnyakov
  • Constructor Details

    • ByteArrayXmlStreamReader

      public ByteArrayXmlStreamReader(byte[] bytes) throws XMLStreamException
      Parameters:
      bytes - raw representation of xml
      Throws:
      XMLStreamException - if byte array represents corrupted xml
  • Method Details

    • reset

      public ByteArrayXmlStreamReader reset()
      The xmlStream is stateful. Once we walked through the whole stream, before we can re-read its content we need to reset state. Unfortunately the stream implementation does not have an api to flush the state, so a simple solution is to create a new instance with the same underlying byte array.
      Returns:
      new instance with fresh state