Class CompleteFileReader<T>

  • Type Parameters:
    T - The type of bean being created
    All Implemented Interfaces:
    java.lang.Runnable

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

      • 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 java.util.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 java.lang.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 Detail

      • CompleteFileReader

        public CompleteFileReader​(CSVReader csvReader,
                                  CsvToBeanFilter filter,
                                  boolean ignoreEmptyLines,
                                  MappingStrategy<? extends T> mappingStrategy,
                                  CsvExceptionHandler exceptionHandler,
                                  java.util.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 Detail

      • getTerminalException

        public java.lang.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 java.lang.Runnable