- java.lang.Object
-
- org.ojalgo.netio.TextLineReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<java.lang.String>,FromFileReader<java.lang.String>
public final class TextLineReader extends java.lang.Object implements FromFileReader<java.lang.String>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTextLineReader.Parser<T>-
Nested classes/interfaces inherited from interface org.ojalgo.netio.FromFileReader
FromFileReader.Builder<F>
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.BufferedReadermyReader
-
Constructor Summary
Constructors Constructor Description TextLineReader(java.io.InputStream inputStream)TextLineReader(java.io.Reader delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static booleanisLineOK(java.lang.String line)not null, not empty, not blank and not a comment (starts with '#')static TextLineReaderof(java.io.File file)static TextLineReaderof(java.io.File file, OperatorWithException<java.io.InputStream> filter)static TextLineReaderof(java.lang.String pathname)static TextLineReaderof(InMemoryFile file)static TextLineReaderof(InMemoryFile file, OperatorWithException<java.io.InputStream> filter)java.lang.Stringread()Returning null indicates that there are no more items to read.<T> FromFileReader<T>withFilteredParser(java.util.function.Predicate<java.lang.String> filter, TextLineReader.Parser<T> parser)The filter could for instance beisLineOK(String)<T> FromFileReader<T>withFilteredParser(TextLineReader.Parser<T> parser)The filter isisLineOK(String)<T> FromFileReader<T>withParser(TextLineReader.Parser<T> parser)-
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
drainTo, forEachInBacthes, iterator, map, stream
-
-
-
-
Method Detail
-
isLineOK
public static boolean isLineOK(java.lang.String line)
not null, not empty, not blank and not a comment (starts with '#')
-
of
public static TextLineReader of(java.io.File file)
-
of
public static TextLineReader of(java.io.File file, OperatorWithException<java.io.InputStream> filter)
-
of
public static TextLineReader of(InMemoryFile file)
-
of
public static TextLineReader of(InMemoryFile file, OperatorWithException<java.io.InputStream> filter)
-
of
public static TextLineReader of(java.lang.String pathname)
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceFromFileReader<java.lang.String>- Throws:
java.io.IOException
-
read
public java.lang.String read()
Description copied from interface:FromFileReaderReturning 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:
readin interfaceFromFileReader<java.lang.String>
-
withFilteredParser
public <T> FromFileReader<T> withFilteredParser(TextLineReader.Parser<T> parser)
The filter isisLineOK(String)
-
withFilteredParser
public <T> FromFileReader<T> withFilteredParser(java.util.function.Predicate<java.lang.String> filter, TextLineReader.Parser<T> parser)
The filter could for instance beisLineOK(String)
-
withParser
public <T> FromFileReader<T> withParser(TextLineReader.Parser<T> parser)
-
-