- 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 extends Object,T_CONS extends Object, 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 TypeMethodDescriptionvoidclose()default voidforEachRemaining(Consumer<? super R> action) row()Returns a reference to the current row, which is null if the scanner is closed.step()Step to the next row.Step to the next row.default booleantryAdvance(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- Returns:
- the next row or null if no more rows remain and scanner has been closed
- Throws:
NullPointerException- if the given row object is nullIOException
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<R>
-
forEachRemaining
- Specified by:
forEachRemainingin interfaceSpliterator<R>
-
trySplit
- Specified by:
trySplitin interfaceSpliterator<R>
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-