CsvSampleReader (Apache JMeter dist API)
Description: declaration: package: org.apache.jmeter.report.core, class: CsvSampleReader

Package org.apache.jmeter.report.core

# Class CsvSampleReader

java.lang.Object
org.apache.jmeter.report.core.CsvSampleReader

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class CsvSampleReader extends Object implements Closeable
Reader class for reading CSV files.

Handles `SampleMetadata` reading and sample extraction.

Since:
  3.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CsvSampleReader(File inputFile, char separator, boolean useSaveSampleCfg)`
  Instantiates a new csv sample reader.
  `CsvSampleReader(File inputFile, SampleMetadata metadata)`
  Instantiates a new csv sample reader.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `SampleMetadata`
  `getMetadata()`
  `boolean`
  `hasNext()`
  `Sample`
  `peek()`
  `Sample`
  `readSample()`

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

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

- ## Constructor Details

  - ### CsvSampleReader

    public CsvSampleReader(File inputFile, char separator, boolean useSaveSampleCfg)
    Instantiates a new csv sample reader.
    Parameters:
      `inputFile` - the input file (must not be `null`)
      `separator` - the separator
      `useSaveSampleCfg` - indicates whether the reader uses jmeter SampleSaveConfiguration to define metadata

  - ### CsvSampleReader

    public CsvSampleReader(File inputFile, SampleMetadata metadata)
    Instantiates a new csv sample reader.
    Parameters:
      `inputFile` - the input file (must not be `null`)
      `metadata` - the metadata

- ## Method Details

  - ### getMetadata

    public SampleMetadata getMetadata()

  - ### readSample

    public Sample readSample()
    Returns:
      next sample from the file.

  - ### peek

    public Sample peek()
    Returns:
      next sample from file but keep the reading file position.

  - ### hasNext

    public boolean hasNext()
    Returns:
      flag, that indicates whether the file contains more samples

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`