How to append data to a file?

后端 未结 4 947
长情又很酷
长情又很酷 2020-11-30 14:43

I trying to write into the txt file.
But with out losing the data that is already stored in the file.

But my problem that when I put string in the txt file, the

4条回答
  •  天命终不由人
    2020-11-30 15:03

    In Java 7,

    Files.write(FileSystems.getDefault().getPath(targetDir,fileName),
    strContent.getBytes(),StandardOpenOption.CREATE,StandardOpenOption.APPEND);
    

提交回复
热议问题