Class FlatFileItemWriter<T>
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemWriter<T>
org.springframework.batch.item.support.AbstractFileItemWriter<T>
org.springframework.batch.item.file.FlatFileItemWriter<T>
- All Implemented Interfaces:
ResourceAwareItemWriterItemStream<T>
,ItemStream
,ItemStreamWriter<T>
,ItemWriter<T>
,org.springframework.beans.factory.InitializingBean
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
Uses buffered writer to improve performance.
The implementation is not thread-safe.
Resource
and
must represent a writable file.Uses buffered writer to improve performance.
The implementation is not thread-safe.
- Author:
- Waseem Malik, Tomas Slanina, Robert Kasanicky, Dave Syer, Michael Minella, Mahmoud Ben Hassine
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.batch.item.support.AbstractFileItemWriter
AbstractFileItemWriter.OutputState
-
Field Summary
Fields inherited from class org.springframework.batch.item.support.AbstractFileItemWriter
append, DEFAULT_CHARSET, DEFAULT_LINE_SEPARATOR, DEFAULT_TRANSACTIONAL, lineSeparator, logger, shouldDeleteIfExists, state
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Assert that mandatory properties (lineAggregator) are set.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.void
setLineAggregator
(LineAggregator<T> lineAggregator) Public setter for theLineAggregator
.Methods inherited from class org.springframework.batch.item.support.AbstractFileItemWriter
close, getOutputState, open, setAppendAllowed, setEncoding, setFooterCallback, setForceSync, setHeaderCallback, setLineSeparator, setResource, setSaveState, setShouldDeleteIfEmpty, setShouldDeleteIfExists, setTransactional, update, write
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
-
Field Details
-
lineAggregator
-
-
Constructor Details
-
FlatFileItemWriter
public FlatFileItemWriter()
-
-
Method Details
-
afterPropertiesSet
Assert that mandatory properties (lineAggregator) are set.- Throws:
Exception
- See Also:
-
InitializingBean.afterPropertiesSet()
-
setLineAggregator
Public setter for theLineAggregator
. This will be used to translate the item into a line for output.- Parameters:
lineAggregator
- theLineAggregator
to set
-
doWrite
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 classAbstractFileItemWriter<T>
- Parameters:
items
- to be written- Returns:
- written lines
-