Class HeaderCopyCallback
- java.lang.Object
- org.springframework.batch.sample.support.HeaderCopyCallback
- All Implemented Interfaces:
FlatFileHeaderCallback
,LineCallbackHandler
public class HeaderCopyCallback extends java.lang.Object implements LineCallbackHandler, FlatFileHeaderCallback
Designed to be registered with bothFlatFileItemReader
andFlatFileItemWriter
and copy header line from input file to output file.
Constructor Summary
Constructors Constructor Description HeaderCopyCallback()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleLine(java.lang.String line)
void
writeHeader(java.io.Writer writer)
Write contents to a file using the suppliedWriter
.
Method Detail
handleLine
public void handleLine(java.lang.String line)
- Specified by:
handleLine
in interfaceLineCallbackHandler
writeHeader
public void writeHeader(java.io.Writer writer) throws java.io.IOException
Description copied from interface:FlatFileHeaderCallback
Write contents to a file using the suppliedWriter
. It is not required to flush the writer inside this method.- Specified by:
writeHeader
in interfaceFlatFileHeaderCallback
- Parameters:
writer
- theWriter
to be used to write the header.- Throws:
java.io.IOException
- if error occurs during writing.