Re: How to append text to the beginning of the file using Camel

2017-04-05 Thread Amruta Jawlekar
Thank you souciance. Enrich best suits my requirement and it worked! :)



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


Re: How to append text to the beginning of the file using Camel

2017-04-04 Thread souciance
You could perhaps PollEnrich to fetch the data from the file then then
simply concatenate the new portion to the file data and then write to the
same file again. But its easier to write some bean method to do this.

On Tue, Apr 4, 2017 at 2:11 PM, Amruta Jawlekar [via Camel] <
ml-node+s465427n5796909...@n5.nabble.com> wrote:

> Thanks Claus for your prompt response :)
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/How-to-append-text-to-the-
> beginning-of-the-file-using-Camel-tp5796906p5796909.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




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

Re: How to append text to the beginning of the file using Camel

2017-04-04 Thread Amruta Jawlekar
Thanks Claus for your prompt response :)



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


Re: How to append text to the beginning of the file using Camel

2017-04-04 Thread Claus Ibsen
Hi

Yeah write your own java class / method that appends to the start of the file.

There is no such functionality out of the box, as fileExists=Append
appends at the end

On Tue, Apr 4, 2017 at 1:12 PM, Amruta Jawlekar  wrote:
> 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 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.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2