Class FlatFileItemWriter<T>

All Implemented Interfaces:
ResourceAwareItemWriterItemStream<T>, ItemStream, ItemStreamWriter<T>, ItemWriter<T>, org.springframework.beans.factory.InitializingBean

public class FlatFileItemWriter<T> extends AbstractFileItemWriter<T>
This class is an item writer that writes data to a file or stream. The writer also provides restart. The location of the output file is defined by a Resource and must represent a writable file.
Uses buffered writer to improve performance.
The implementation is not thread-safe.
Waseem Malik, Tomas Slanina, Robert Kasanicky, Dave Syer, Michael Minella, Mahmoud Ben Hassine
  • Field Details

  • Constructor Details

    • FlatFileItemWriter

      public FlatFileItemWriter()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Assert that mandatory properties (lineAggregator) are set.
      See Also:
      • InitializingBean.afterPropertiesSet()
    • setLineAggregator

      public void setLineAggregator(LineAggregator<T> lineAggregator)
      Public setter for the LineAggregator. This will be used to translate the item into a line for output.
      lineAggregator - the LineAggregator to set
    • doWrite

      public String doWrite(Chunk<? extends T> items)
      Description copied from class: AbstractFileItemWriter
      Write out a string of items followed by a "new line", where the format of the new line separator is determined by the underlying operating system.
      Specified by:
      doWrite in class AbstractFileItemWriter<T>
      items - to be written
      written lines