camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amruta Jawlekar <amrut...@ignitiv.com>
Subject How to append text to the beginning of the file using Camel
Date Tue, 04 Apr 2017 11:12:37 GMT
Hi All,

I need to append text like XML Header tag in the beginning of a file.
I know one way to achieve it - 
1. Create a String/StringBuilder/List<String> having header tag.
2. Unmarshal the file contents and convert inputstream to List/String or any
suitable object
3. Append the existing contents to the header tag String/List
4. Write contents to same file.

But I feel that the 2nd step is unnecessary. I just need to append the XML
tag to the start of file, regardless of what contents the File already has.

Please let me know if Camel supports this? setting FileExists = Append
always appends the text at the end of file, I need it in the beginning.

OR 

is it better that I directly use the Java File API to do the same instead of
above mentioned steps.

Any pointers would be helpful. 
Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-append-text-to-the-beginning-of-the-file-using-Camel-tp5796906.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message