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
ConstructorDescriptionCsvSampleWriter
(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 TypeMethodDescriptionvoid
setSeparator
(char separator) Set the char to use for separation of data in a line.void
Set 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.long
Write a sample to the underlying destinationvoid
Write 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 (metadata
must not benull
).
-
CsvSampleWriter
- Parameters:
output
- the writer to write data to. (Must not benull
)metadata
- the description for data that this writer will write. (metadata
must 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. (metadata
must 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. (metadata
must 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:AbstractSampleWriter
Set 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:
setWriter
in 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:SampleWriter
Write a sample to the underlying destination- Specified by:
write
in classSampleWriter
- Parameters:
sample
- The sample to be written (Must not benull
)- Returns:
- The number of samples written at this time to the underlying destination
-