Interface Scanner<R>

All Superinterfaces:
AutoCloseable, Closeable, Spliterator<R>
All Known Subinterfaces:
Updater<R>

public interface Scanner<R> extends Spliterator<R>, Closeable
Support for scanning through all rows in a table. Any exception thrown when acting upon a scanner automatically closes it.

Scanner instances can only be safely used by one thread at a time, and they must be closed when no longer needed. Instances can be exchanged by threads, as long as a happens-before relationship is established. Without proper exclusion, multiple threads interacting with a Scanner instance may cause database corruption.

See Also:
  • Method Details

    • row

      R row()
      Returns a reference to the current row, which is null if the scanner is closed.
    • step

      default R step() throws IOException
      Step to the next row.
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IOException
    • step

      R step(R row) throws IOException
      Step to the next row.
      Parameters:
      row - use this for the next row instead of creating a new one; if null is passed in, a new instance will be created if necessary
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IOException
    • tryAdvance

      default boolean tryAdvance(Consumer<? super R> action)
      Specified by:
      tryAdvance in interface Spliterator<R>
    • forEachRemaining

      default void forEachRemaining(Consumer<? super R> action)
      Specified by:
      forEachRemaining in interface Spliterator<R>
    • trySplit

      default Spliterator<R> trySplit()
      Specified by:
      trySplit in interface Spliterator<R>
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException