Package org.ojalgo.netio
Class TextLineWriter
- java.lang.Object
-
- org.ojalgo.netio.TextLineWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.util.function.Consumer<java.lang.CharSequence>
,ToFileWriter<java.lang.CharSequence>
,AutoConsumer<java.lang.CharSequence>
,AutoFunctional
public final class TextLineWriter extends java.lang.Object implements ToFileWriter<java.lang.CharSequence>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextLineWriter.CSVLineBuilder
A reusable delimited "text line" builder.static interface
TextLineWriter.Formatter<T>
-
Nested classes/interfaces inherited from interface org.ojalgo.netio.ToFileWriter
ToFileWriter.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.BufferedWriter
myWriter
-
Fields inherited from interface org.ojalgo.type.function.AutoConsumer
NULL
-
-
Constructor Summary
Constructors Constructor Description TextLineWriter(java.io.OutputStream outputStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
TextLineWriter.CSVLineBuilder
newCSVLineBuilder(char delimiter)
TextLineWriter.CSVLineBuilder
newCSVLineBuilder(java.lang.String delimiter)
static TextLineWriter
of(java.io.File file)
static TextLineWriter
of(java.io.File file, OperatorWithException<java.io.OutputStream> filter)
static TextLineWriter
of(InMemoryFile file)
static TextLineWriter
of(InMemoryFile file, OperatorWithException<java.io.OutputStream> filter)
<T> AutoConsumer<T>
withFormatter(TextLineWriter.Formatter<T> formatter)
void
write(java.lang.CharSequence itemToWrite)
Write the item to the consumer.-
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.AutoConsumer
accept, writeBatch
-
-
-
-
Method Detail
-
of
public static TextLineWriter of(java.io.File file)
-
of
public static TextLineWriter of(java.io.File file, OperatorWithException<java.io.OutputStream> filter)
-
of
public static TextLineWriter of(InMemoryFile file)
-
of
public static TextLineWriter of(InMemoryFile file, OperatorWithException<java.io.OutputStream> filter)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceAutoConsumer<java.lang.CharSequence>
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceToFileWriter<java.lang.CharSequence>
- Throws:
java.io.IOException
-
newCSVLineBuilder
public TextLineWriter.CSVLineBuilder newCSVLineBuilder(char delimiter)
- See Also:
TextLineWriter.CSVLineBuilder
-
newCSVLineBuilder
public TextLineWriter.CSVLineBuilder newCSVLineBuilder(java.lang.String delimiter)
- See Also:
TextLineWriter.CSVLineBuilder
-
withFormatter
public <T> AutoConsumer<T> withFormatter(TextLineWriter.Formatter<T> formatter)
-
write
public void write(java.lang.CharSequence itemToWrite)
Description copied from interface:AutoConsumer
Write the item to the consumer.- Specified by:
write
in interfaceAutoConsumer<java.lang.CharSequence>
- Parameters:
itemToWrite
- The item to be written
-
-