Package org.apache.jmeter.report.core
Class CsvSampleWriter
java.lang.Object
org.apache.jmeter.report.core.SampleWriter
org.apache.jmeter.report.core.AbstractSampleWriter
org.apache.jmeter.report.core.CsvSampleWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
Class to be used to write samples to a csv destination (OutputStream, Writer
or a File).
This class handles csv header writing with the writeHeader
method. This method has to be called by user for the header to be written.
- Since:
- 3.0
-
Field Summary
Fields inherited from class org.apache.jmeter.report.core.AbstractSampleWriter
writer -
Constructor Summary
ConstructorsConstructorDescriptionCsvSampleWriter(File output, SampleMetadata metadata) CsvSampleWriter(OutputStream output, SampleMetadata metadata) CsvSampleWriter(Writer output, SampleMetadata metadata) CsvSampleWriter(SampleMetadata metadata) The new instance has to be supplied with a Writer to work properly. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetSeparator(char separator) Set the char to use for separation of data in a line.voidSet the new writer on which samples will be written by this sample writer.
If any writer exists on the sample writer, it is flushed and closed before being replaced by the new one.longWrite a sample to the underlying destinationvoidWrite the csv header.Methods inherited from class org.apache.jmeter.report.core.AbstractSampleWriter
close, setOutputFile, setOutputStream
-
Constructor Details
-
CsvSampleWriter
The new instance has to be supplied with a Writer to work properly.- Parameters:
metadata- the description for data that this writer will write (metadatamust not benull).
-
CsvSampleWriter
- Parameters:
output- the writer to write data to. (Must not benull)metadata- the description for data that this writer will write. (metadatamust not benull.)
-
CsvSampleWriter
- Parameters:
output- the output stream to write data to. (Must not benull)metadata- the description for data that this writer will write. (metadatamust not benull.)
-
CsvSampleWriter
- Parameters:
output- the output file to write data to. (Must not benull)metadata- the description for data that this writer will write. (metadatamust not benull.)
-
-
Method Details
-
setSeparator
public void setSeparator(char separator) Set the char to use for separation of data in a line.- Parameters:
separator- to use
-
setWriter
Description copied from class:AbstractSampleWriterSet the new writer on which samples will be written by this sample writer.
If any writer exists on the sample writer, it is flushed and closed before being replaced by the new one.- Overrides:
setWriterin classAbstractSampleWriter- Parameters:
writer- The destination writer where samples will be written by this sample writer
-
writeHeader
public void writeHeader()Write the csv header. If samples have already been written then a row with header information will be written in the middle of the file. -
write
Description copied from class:SampleWriterWrite a sample to the underlying destination- Specified by:
writein classSampleWriter- Parameters:
sample- The sample to be written (Must not benull)- Returns:
- The number of samples written at this time to the underlying destination
-