Interface SeekableReader

All Superinterfaces:
SpanProvider

public interface SeekableReader extends SpanProvider
An IonReader facet providing the ability to retrieve Spans (abstract value positions) and seek to positions within the source.

WARNING: This interface should not be implemented or extended by code outside of this library.

A span may be used to seek a different reader instance than the one that generated it, provided that the two readers have the same source. Violations of this constraint may not be detected reliably, so be careful or you'll get unsatisfying results.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    hoist(Span span)
    Seeks this reader to produce the given span as if its values were at top-level.

    Methods inherited from interface com.amazon.ion.SpanProvider

    currentSpan
  • Method Details

    • hoist

      void hoist(Span span)
      Seeks this reader to produce the given span as if its values were at top-level. The caller cannot stepOut from the span nor continue reading beyond it.

      After calling this method, this reader's current span will be empty and positioned just before the first value of the given span; the caller must call next() to begin reading values. At the end of the span, the reader will behave as if it's at EOF regardless whether the source has more data beyond the span.

      Hoisting makes the span's values appear to be at top-level even if they have containers in the source. The depth will be zero, and calls to getFieldName() will return null even if the span's original parent was a struct.

      Throws:
      IonException - if the given span is unbalanced.