Package org.ojalgo.netio
Class ManagedReader<T>
- java.lang.Object
-
- org.ojalgo.netio.ManagedReader<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<T>
,FromFileReader<T>
final class ManagedReader<T> extends java.lang.Object implements FromFileReader<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.netio.FromFileReader
FromFileReader.Builder<F>
-
-
Field Summary
Fields Modifier and Type Field Description private Throughput
myManager
private FromFileReader<T>
myReader
-
Constructor Summary
Constructors Constructor Description ManagedReader(Throughput manager, FromFileReader<T> reader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
drainTo(java.util.Collection<? super T> container, int maxElements)
Behaves similar toBlockingQueue.drainTo(Collection, int)
except that returning 0 means there are no more items to read.T
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
-
-
-
-
Field Detail
-
myManager
private final Throughput myManager
-
myReader
private final FromFileReader<T> myReader
-
-
Constructor Detail
-
ManagedReader
ManagedReader(Throughput manager, FromFileReader<T> reader)
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceFromFileReader<T>
- Throws:
java.io.IOException
-
drainTo
public int drainTo(java.util.Collection<? super T> container, int maxElements)
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
public 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>
-
-