Append data into a file using Apache Commons I/O

前端 未结 7 1609
野的像风
野的像风 2020-12-09 14:48

The FileUtils.writeStringToFile(fileName, text) function of Apache Commons I/O overwrites previous text in a file. I would like to append data to my file. Is th

7条回答
  •  北海茫月
    2020-12-09 15:29

    in version 2.5 you need to pass one extra parameter i.e, encoding.

    FileUtils.writeStringToFile(file, "line to append", "UTF-8", true);
    

提交回复
热议问题