seek abstract method

void seek(
  1. int index
)

Set the input cursor to the position indicated by index. If the specified index lies past the end of the stream, the operation behaves as though index was the index of the EOF symbol. After this method returns without throwing an exception, then at least one of the following will be true.

  • {@link #index index()} will return the index of the first symbol appearing at or after the specified [index]. Specifically, implementations which filter their sources should automatically adjust [index] forward the minimum amount required for the operation to target a non-ignored symbol.
  • {@code LA(1)} returns {@link #EOF}

This operation is guaranteed to not throw an exception if index lies within a marked region. For more information on marked regions, see {@link #mark}. The behavior of this method is unspecified if no call to an {@link IntStream initializing method} has occurred after this stream was constructed.

@param index The absolute index to seek to.

@throws IllegalArgumentException if index is less than 0 @throws UnsupportedOperationException if the stream does not support seeking to the specified index

Implementation

void seek(int index);