Package org.ojalgo.netio
Class QueuedReader<T>
java.lang.Object
org.ojalgo.netio.QueuedReader<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<T>
,FromFileReader<T>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.ojalgo.netio.FromFileReader
FromFileReader.Builder<F>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Future<?>[]
private final BlockingQueue
<T> private final FromFileReader<T>[]
-
Constructor Summary
ConstructorsConstructorDescriptionQueuedReader
(ExecutorService executor, BlockingQueue<T> queue, FromFileReader<T>... readers) Multiple suppliers supply to a queue, then you get from that queue. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
drainTo
(Collection<? super T> container, int maxElements) Behaves similar toBlockingQueue.drainTo(Collection, int)
except that returning 0 means there are no more items to read.private boolean
isDone()
read()
Returning null indicates that there are no more items to read.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ojalgo.netio.FromFileReader
forEachInBacthes, iterator, map, stream
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
myFutures
-
myQueue
-
myReaders
-
-
Constructor Details
-
QueuedReader
QueuedReader(ExecutorService executor, BlockingQueue<T> queue, FromFileReader<T>... readers) Multiple suppliers supply to a queue, then you get from that queue. There will be 1 thread (executor task) per supplier.
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceFromFileReader<T>
- Throws:
IOException
-
drainTo
Description copied from interface:FromFileReader
Behaves similar toBlockingQueue.drainTo(Collection, int)
except that returning 0 means there are no more items to read.- Specified by:
drainTo
in interfaceFromFileReader<T>
-
read
Description copied from interface:FromFileReader
Returning null indicates that there are no more items to read. That's the same behaviour asBufferedReader.readLine()
. All implementations must return null precisely once.- Specified by:
read
in interfaceFromFileReader<T>
-
isDone
private boolean isDone()
-