Class FlatFileItemReader<T>

All Implemented Interfaces:
ResourceAwareItemReaderItemStream<T>, ItemReader<T>, ItemStream, ItemStreamReader<T>

public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemReader<T> implements ResourceAwareItemReaderItemStream<T>
Restartable ItemReader that reads lines from input setResource(Resource). Line is defined by the setRecordSeparatorPolicy(RecordSeparatorPolicy) and mapped to item using setLineMapper(LineMapper). If an exception is thrown during line mapping it is rethrown as FlatFileParseException adding information about the problematic line and its line number.

This reader is not thread-safe.

Author:
Robert Kasanicky, Mahmoud Ben Hassine, Stefano Cordio
  • Field Details

    • DEFAULT_CHARSET

      public static final String DEFAULT_CHARSET
    • DEFAULT_COMMENT_PREFIXES

      public static final String[] DEFAULT_COMMENT_PREFIXES
    • comments

      protected String[] comments
  • Constructor Details

    • FlatFileItemReader

      public FlatFileItemReader(LineMapper<T> lineMapper)
      Create a new FlatFileItemReader with a LineMapper.
      Parameters:
      lineMapper - to use to map lines to items
      Since:
      6.0
    • FlatFileItemReader

      public FlatFileItemReader(org.springframework.core.io.Resource resource, LineMapper<T> lineMapper)
      Create a new FlatFileItemReader with a Resource and a LineMapper.
      Parameters:
      resource - the input resource
      lineMapper - to use to map lines to items
      Since:
      6.0
  • Method Details