Package io.datarouter.scanner
Class BaseLinkedScanner<T,R>
java.lang.Object
io.datarouter.scanner.BaseScanner<R>
io.datarouter.scanner.BaseLinkedScanner<T,R>
- All Implemented Interfaces:
Scanner<R>,Closeable,AutoCloseable
- Direct Known Subclasses:
AdvanceUntilScanner,AdvanceWhileScanner,BatchingScanner,ComparableScanner,ConcatenatingScanner,DeduplicatingScanner,DistinctScanner,EachScanner,FilteringScanner,LimitingScanner,MappingScanner,PrefetchingScanner,RetainingScanner,SamplingScanner,ShufflingScanner,SortingScanner,SplittingScanner,SteppingScanner
public abstract class BaseLinkedScanner<T,R> extends BaseScanner<R>
Subclasses do not have to worry about closing the input scanner.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BaseLinkedScanner(Scanner<T> input) -
Method Summary
Modifier and Type Method Description booleanadvance()Try to update current to the next item, if there is one.protected abstract booleanadvanceInternal()voidclose()Override to cleanup any resources.protected voidcloseInternal()Extend to close internal resources before the input scanner is closed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.datarouter.scanner.Scanner
advanceUntil, advanceWhile, allMatch, anyMatch, append, append, append, apply, batch, collate, collate, collect, collect, concat, concatIter, count, deduplicate, deduplicateBy, distinct, distinctBy, each, exclude, findAny, findFirst, findLast, flush, forEach, groupBy, groupBy, groupBy, groupBy, hasAny, include, isEmpty, iterable, iterator, limit, link, list, listTo, map, max, min, noneMatch, parallel, prefetch, reduce, reduce, retain, sample, shuffle, skip, sorted, sorted, splitBy, stream, streamDoubles, streamInts, streamLongs, take, then, toArray, toMap, toMap, toMap, toMap, toMapSupplied, toMapSupplied, toMapSupplied, toMapSupplied
-
Field Details
-
Constructor Details
-
Method Details
-
advanceInternal
protected abstract boolean advanceInternal() -
advance
public final boolean advance()Description copied from interface:ScannerTry to update current to the next item, if there is one.- Returns:
- True if it advanced
-
closeInternal
protected void closeInternal()Extend to close internal resources before the input scanner is closed. -
close
public final void close()Description copied from interface:ScannerOverride to cleanup any resources. The call should be propagated to all parent scanners. In the infrequent case of calling advance/current in an application, the Scanner should be explicitly closed. Because the included Scanner operations will close themselves when they fail to advance, it frequently a no-op for the application, unless closing the scanner before it stops advancing.
-