Top Description Methods
com.amazon.ion

public Interface OffsetSpan

Known Direct Implementers
com.amazon.ion.impl.IonReaderContinuableTopLevelBinary.IonReaderBinarySpan, com.amazon.ion.impl.IonReaderTextUserX.IonReaderTextSpan
Imports
com.amazon.ion.facet.Faceted, .Facets, java.io.InputStream

Exposes the positions of a Span in the form of zero-based offsets within the source. The "unit of measure" the offsets count depends on the source type: for byte arrays or InputStreams, the offsets count octets, but for Strings or java.io.Readers the offsets count UTF-16 code units.

Warning

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

As with all spans, positions lie between values, and when the start and finish positions are equal, the span is said to be empty.

To get one of these from a Span, use asFacet(OffsetSpan.class) or one of the helpers from Facets.

Method Summary

Modifier and TypeMethod and Description
public long
getFinishOffset()

Returns this span's finish position as a zero-based offset within the source.

public long
getStartOffset()

Returns this span's start position as a zero-based offset within the source.

Method Detail

getFinishOffsetback to summary
public long getFinishOffset()

Returns this span's finish position as a zero-based offset within the source. In some cases, the finish position is implicit and this method returns -1. This includes most text sources, since in general (notably for containers) the finish offset can't be determined without significant effort to parse to the end of the value.

getStartOffsetback to summary
public long getStartOffset()

Returns this span's start position as a zero-based offset within the source.