Writing at the end of a file via opencsv

前端 未结 4 675
离开以前
离开以前 2020-12-20 11:58

I\'m using opencsv and want to write to a .csv file through multiple sessions. However every time I start a new CSVWriter the old file gets erased. Can I change

4条回答
  •  时光取名叫无心
    2020-12-20 12:45

    There's an option in the FileWriter instead of the CSVWriter to append at the end of the file.

    This code makes it work:

    mFileWriter = new FileWriter(file_path, true);
    mCsvWriter = new CSVWriter(mFileWriter);
    

提交回复
热议问题