org.apache.jmeter.report.processor

## Class SampleWriterConsumer

- java.lang.Object
- - org.apache.jmeter.report.processor.AbstractSampleProcessor
  - - org.apache.jmeter.report.processor.AbstractSampleConsumer
    - - org.apache.jmeter.report.processor.SampleWriterConsumer

- All Implemented Interfaces:
    SampleConsumer, SampleProcessor, SampleProducer

      public class SampleWriterConsumer
      extends AbstractSampleConsumer

  Sample consumed by this consumer are written to a file
  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SampleWriterConsumer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `consume(Sample s, int channel)` Consumes the specified sample ton the specified channel.
    `java.io.File` | `getOutputFile()`
    `java.io.File` | `getOutputFile(int channel)`
    `void` | `setOutputFile(java.io.File outputFile)`
    `void` | `setOutputFile(java.lang.String outputFile)`
    `void` | `setWriteHeader(boolean writeHeader)` Enables the CSV header on the output file (defaults to false)
    `void` | `startConsuming()` Start the sample consuming.
    `void` | `stopConsuming()` Stops the consuming process.

    - ### Methods inherited from class org.apache.jmeter.report.processor.AbstractSampleConsumer

      `addSampleConsumer, getConsumedChannelCount, getConsumedMetadata, getConsumer, getDataFromContext, getName, getWorkingDirectory, produce, removeSampleConsumer, setChannelAttribute, setConsumedMetadata, setDataToContext, setName, setProducedMetadata, setSampleConsumer, setSampleConsumers, setSampleContext, startProducing, stopProducing`

    - ### Methods inherited from class org.apache.jmeter.report.processor.AbstractSampleProcessor

      `getChannelAttribute, getSampleContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.report.processor.SampleProcessor

      `getChannelAttribute, getSampleContext`

- - ### Constructor Detail

    - #### SampleWriterConsumer

          public SampleWriterConsumer()

  - ### Method Detail

    - #### setOutputFile

          public void setOutputFile(java.lang.String outputFile)

    - #### setOutputFile

          public void setOutputFile(java.io.File outputFile)

    - #### getOutputFile

          public java.io.File getOutputFile()

    - #### getOutputFile

          public java.io.File getOutputFile(int channel)

    - #### setWriteHeader

          public void setWriteHeader(boolean writeHeader)

      Enables the CSV header on the output file (defaults to false)
      Parameters:
        `writeHeader` - flag, whether CSV header should be written

    - #### startConsuming

          public void startConsuming()

      Description copied from interface: `SampleConsumer`
      Start the sample consuming. This step is used by consumer to initialize their process.

    - #### consume

          public void consume(Sample s,
                              int channel)

      Description copied from interface: `SampleConsumer`
      Consumes the specified sample ton the specified channel.
      Parameters:
        `s` - The sample to be consumed
        `channel` - The channel on which the sample is consumed

    - #### stopConsuming

          public void stopConsuming()

      Description copied from interface: `SampleConsumer`
      Stops the consuming process. No sample will be processed after this service has been called.

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.