普通IO和BufferIO的区别
package cn.qqjx.io;
import java.io.*;
public class IOApplication {
public static void main(String[] args) throws Exception {
String path = "E:\\workspace\\io\\a.txt";
byte[] data = "0123456789\n".getBytes();
testBufferIO(path,data);
}
public static void testBasicIO(String path,byte[]data) throws Exception {
File file = new File(path);
FileOutputStream fos = new FileOutputStream(file);
while (true){
fos.write(data);
}
}
public static void testBufferIO(String path,byte[]data) throws Exception {
File file = new File(path);
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
while (true){
out.write(data);
}
}
}