Class CompleteFileReader<T>

java.lang.Object
com.opencsv.bean.concurrent.SingleLineReader
com.opencsv.bean.concurrent.CompleteFileReader<T>
Type Parameters:
T - The type of bean being created
All Implemented Interfaces:
Runnable

public class CompleteFileReader<T> extends SingleLineReader implements Runnable
Implements a separate thread for reading input and siphoning it to a LineExecutor.
Since:
5.2
  • Field Details

    • filter

      private final CsvToBeanFilter filter
      Filter to be applied to the input.
    • mappingStrategy

      private final MappingStrategy<? extends T> mappingStrategy
      The mapping strategy in use.
    • exceptionHandler

      private final CsvExceptionHandler exceptionHandler
      Whether exceptions in processing should be thrown or collected.
    • verifiers

      private final List<BeanVerifier<T>> verifiers
      Verifiers to be applied to the beans created.
    • lineProcessed

      private long lineProcessed
      Counts how many records have been read from the input.
    • terminalException

      private Throwable terminalException
      The exception that brought execution to a grinding halt.
    • executor

      private LineExecutor<T> executor
      The executor that takes lines of input and converts them to beans.
  • Constructor Details

    • CompleteFileReader

      public CompleteFileReader(CSVReader csvReader, CsvToBeanFilter filter, boolean ignoreEmptyLines, MappingStrategy<? extends T> mappingStrategy, CsvExceptionHandler exceptionHandler, List<BeanVerifier<T>> verifiers)
      Parameters:
      csvReader - The CSVReader from which input is read
      filter - Filter to be applied to the input
      ignoreEmptyLines - Whether empty lines of input should be ignored
      mappingStrategy - The mapping strategy in use
      exceptionHandler - Determines the exception handling behavior
      verifiers - Verifiers to be applied to the beans created
  • Method Details

    • getTerminalException

      public Throwable getTerminalException()
      Returns:
      The exception that brought execution to a halt
    • getLineProcessed

      public long getLineProcessed()
      Returns:
      How many lines have been processed thus far
    • setExecutor

      public void setExecutor(LineExecutor<T> executor)
      Sets the executor that will convert text input to bean output.
      Parameters:
      executor - The executor to use
    • run

      public void run()
      Runs a nice, tight loop to simply read input and submit for conversion.
      Specified by:
      run in interface Runnable