Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将文本附加到 JavaIoFileSystemAccess 中的文件?
我尝试使用相同的文件名调用 generateFile,但它只是覆盖了文件的内容。
有没有我可以调用的设置或方法来将内容附加到文件中?
您可以FileWriter class为此使用重载的构造函数。
FileWriter
class
FileWriter fileWriter = new FileWriter(new File("filepath in string"),true); //second parameter specifies whether write this file in append mode or normal mode //true for append mode