Package com.amazon.ion
Interface OffsetSpan
public interface OffsetSpan
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 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 TypeMethodDescriptionlongReturns this span's finish position as a zero-based offset within the source.longReturns this span's start position as a zero-based offset within the source.
-
Method Details
-
getStartOffset
long getStartOffset()Returns this span's start position as a zero-based offset within the source. -
getFinishOffset
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.
-