Search code examples
spring-batchrecorddouble-quotesseparatoritemwriter

Spring Batch: How can i set record separator policy in FlatFileItemWriter?


I need to write record with the same reading format. Example:

aaa;bbb;ccc;dd
dd;zzz

What I need is to attach the record with double quotes:

aaa;bbb;ccc;"dd
dd";zzz

How can i do it? In FlatFileItemReader there is the option to use RecordSeparatorPolicy which does, but in FlatFileItemWriter???


Solution

  • There is no equivalent to RecordSeparatorPolicy on the writer side. You need a custom LineAggregator for this use case.