maven 创建的java工程,导入依赖
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
1、文件追加
public class CreateMoreAccount {
public static void main(String[] args) throw IOException{
File in = new File("test_data/Accout_test.properties");
File out = new File("test_data/Accout_test_more.properties");
//清除文件内容
FileUtils.write(in,"","UTF-8");
FileUtils.write(out,"","UTF-8");
//追加内容
String content = FileUtils.readFileToString(in,"UTF-8");
FileUtils.writeStringToFile(out,content,"UTF-8",true);
}