T
- the type of Collectable
public class LineOutputWriter<T extends Collectable<?>> extends Object
OutputWriter
implementation writing data line by line in CSV format.EMPTY
Constructor and Description |
---|
LineOutputWriter(T collectable,
Path outputPath)
Constructs a new
WritingCollector . |
Modifier and Type | Method and Description |
---|---|
void |
close()
If this writer keeps any resources open that needs closing, it has to be
done here.
|
protected T |
getCollectable()
Returns the
Collectable containing the data to be written. |
String |
getFileName()
Returns the name of the file where data is to be written.
|
protected de.zmt.output.writing.CsvWriter |
getWriter() |
void |
setOutputPath(Path outputPath)
Sets the output path for this writer.
|
String |
toString() |
protected void |
writeHeaders(de.zmt.output.writing.CsvWriter writer)
Write headers from collectable using the writer.
|
void |
writeValues(long steps)
Implementing classes need to specify how to write values.
|
public LineOutputWriter(T collectable, Path outputPath)
WritingCollector
. Headers are written
immediately after opening the file.collectable
- the Collectable
to write data fromoutputPath
- the file data is written toprotected final de.zmt.output.writing.CsvWriter getWriter()
public void writeValues(long steps) throws IOException
OutputWriter
steps
- the number of steps passed in Schedule
IOException
- If an I/O error occurspublic void setOutputPath(Path outputPath)
OutputWriter
Will be called during deserialization from Output
for all
associated writers. No need to handle serialization within
implementation.
outputPath
- the output pathpublic void close() throws IOException
OutputWriter
IOException
protected final void writeHeaders(de.zmt.output.writing.CsvWriter writer)
writer
- the writer to write the headersprotected T getCollectable()
Collectable
containing the data to be written.Collectable
containing the data to be writtenpublic String getFileName()