Interface Scanner<R>
- All Superinterfaces:
AutoCloseable
,Closeable
,Spliterator<R>
- All Known Subinterfaces:
Updater<R>
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T,
T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
default void
forEachRemaining
(Consumer<? super R> action) row()
Returns a reference to the current row, which is null if the scanner is closed.default R
step()
Step to the next row.Step to the next row.default boolean
tryAdvance
(Consumer<? super R> action) default Spliterator
<R> trySplit()
Methods inherited from interface java.util.Spliterator
characteristics, estimateSize, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Method Details
-
row
R row()Returns a reference to the current row, which is null if the scanner is closed. -
step
Step to the next row.- Returns:
- the next row or null if no more rows remain and scanner has been closed
- Throws:
IOException
-
step
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
- Specified by:
tryAdvance
in interfaceSpliterator<R>
-
forEachRemaining
- Specified by:
forEachRemaining
in interfaceSpliterator<R>
-
trySplit
- Specified by:
trySplit
in interfaceSpliterator<R>
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-