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 and 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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### 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 Detail

    - #### 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 `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`

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