Read/Write from text file to TextArea

I would like to create editable TextArea that read/write from file on filesystem. Can I use TextArea’s setdata to read and write to file? Are there any example in book or tutorial;?


I am not sure if there is an example for this in the book. But I can not see why this should not work.

I would do something like that:

  • Read the content of the file (into a StringBuffer, etc.)
  • Fill the TextArea with the StringBuffer (via setValue())
  • When edit is done get it from the TextArea with getValue()
  • Write the content into a NEW file
  • If the new file was created without any errors remove the origin file
  • Set the filename of the new file to the filename of the origin filename

I am not an expert in Vaadin. But I hope this helps.