I have a output file generated as part of a program with large amount of formatted data.
I want to insert a header to this file in the first line i.e. inserting a new header line at the start of the file.
This requires pushing entire data one line down.
What is the most efficient way to acheive this through randomaccessfile ?
I have item number being passed as part of each item. So if the item number is one, I am creating a header line and adding that to the file in my custom item writer and then delegating the task to flat file item writer to add remaining data.
This solved the issue.