使用newOutputStream()方法进行无缓冲写入
import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path;//N o w J a v a . c o m 提供 import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/folder1/equipment", "test.txt"); String str = "test"; byte data[] = str.getBytes(); try (OutputStream outputStream = Files.newOutputStream(path)) { outputStream.write(da