使用缓冲流保存到文件
import java.io.BufferedWriter;/* 来 自 N o w J a v a . c o m - 时 代 Java*/ import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/folder1/equipment", "test.txt"); String string = "\ntest"; try (OutputStream outputStream = Files.newOutputStream(path, StandardOpenOption.APPEND); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(