Package org.ojalgo.netio
Class TextLineReader
- java.lang.Object
-
- org.ojalgo.netio.TextLineReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.lang.String>
,java.util.function.Supplier<java.lang.String>
,FromFileReader<java.lang.String>
,AutoFunctional
,AutoSupplier<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 interface
TextLineReader.Parser<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.netio.FromFileReader
FromFileReader.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.BufferedReader
myReader
-
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 void
close()
static boolean
isLineOK(java.lang.String line)
not null, not empty, not blank and not a comment (starts with '#')static TextLineReader
of(java.io.File file)
static TextLineReader
of(java.io.File file, OperatorWithException<java.io.InputStream> filter)
static TextLineReader
of(InMemoryFile file)
static TextLineReader
of(InMemoryFile file, OperatorWithException<java.io.InputStream> filter)
java.lang.String
read()
<T> AutoSupplier<T>
withFilteredParser(java.util.function.Predicate<java.lang.String> filter, TextLineReader.Parser<T> parser)
The filter could for instance beisLineOK(String)
<T> AutoSupplier<T>
withFilteredParser(TextLineReader.Parser<T> parser)
The filter isisLineOK(String)
<T> AutoSupplier<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.type.function.AutoSupplier
drainTo, get, iterator, processAll
-
-
-
-
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)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceAutoSupplier<java.lang.String>
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceFromFileReader<java.lang.String>
- Throws:
java.io.IOException
-
read
public java.lang.String read()
- Specified by:
read
in interfaceAutoSupplier<java.lang.String>
-
withFilteredParser
public <T> AutoSupplier<T> withFilteredParser(TextLineReader.Parser<T> parser)
The filter isisLineOK(String)
-
withFilteredParser
public <T> AutoSupplier<T> withFilteredParser(java.util.function.Predicate<java.lang.String> filter, TextLineReader.Parser<T> parser)
The filter could for instance beisLineOK(String)
-
withParser
public <T> AutoSupplier<T> withParser(TextLineReader.Parser<T> parser)
-
-