Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to append the data into exsisting file ?  RSS feed

 
YuenLian Wu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to java IO API, I hope you guys can help me out here.

I have a file that contains the data from runtime Java Application. I am currently using a BufferedWriter to rewrite data to a file each time. All data will be rewrite from the beginning of the file. Indeed, I just want to append the new records to the end of the files. I will give an example in the following.

e.g test.txt

ABCDE
hijkl
123455

I want to append my new data under "123455", what should I do ?

Thanks in advance

Transistor
 
Vlado Zajac
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the Documentation for FileWriter, there are two constructors for appending to file.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!