public class CsvSampleWriter extends AbstractSampleWriter
This class handles csv header writing with the writeHeader
method. This method has to be called by user for the header to be written.
writer
Constructor and Description |
---|
CsvSampleWriter(File output,
SampleMetadata metadata)
Constructor for a CsvSampleWriter.
|
CsvSampleWriter(OutputStream output,
SampleMetadata metadata)
Constructor for a CsvSampleWriter.
|
CsvSampleWriter(SampleMetadata metadata)
Constructor for a CsvSampleWriter.
|
CsvSampleWriter(Writer output,
SampleMetadata metadata)
Constructor for a CsvSampleWriter.
|
Modifier and Type | Method and Description |
---|---|
void |
setSeparator(char separator)
Set the char to use for separation of data in a line.
|
void |
setWriter(Writer writer)
Set he new writer on which samples will be written by this smaple
writter.
|
long |
write(Sample sample)
Write a sample to the underlying destination
|
void |
writeHeader()
Write the csv header.
|
close, flush, setOutputFile, setOutputStream
public CsvSampleWriter(SampleMetadata metadata)
metadata
- the description for data that this writer will write. (
metadata
must not be null
.)public CsvSampleWriter(Writer output, SampleMetadata metadata)
output
- the writer to write data to. (Must not be null
)metadata
- the description for data that this writer will write. (
metadata
must not be null
.)public CsvSampleWriter(OutputStream output, SampleMetadata metadata)
output
- the output stream to write data to. (Must not be null
)metadata
- the description for data that this writer will write. (
metadata
must not be null
.)public CsvSampleWriter(File output, SampleMetadata metadata)
output
- the output file to write data to. (Must not be null
)metadata
- the description for data that this writer will write. (
metadata
must not be null
.)public void setSeparator(char separator)
separator
- to usepublic void setWriter(Writer writer)
AbstractSampleWriter
setWriter
in class AbstractSampleWriter
writer
- The destination writer where samples will be written by this
sample writerpublic void writeHeader()
public long write(Sample sample)
SampleWriter
write
in class SampleWriter
sample
- The sample to be written (Must not be null
)Copyright © 1998-2016 Apache Software Foundation. All Rights Reserved.