标签:缓冲流 buffer 缓冲 while stream puts red put 提升
字节流:
FileInputStream明确数据源,FileOutputStream明确目的地
FileInputStream fos=new FileInputStream("D:\\aaa\\aaa.rar");
FileOutputStream fis=new FileOutputStream("D:\\bbb\\aaa\\aaa.txt");
int len=0;
//单个字节
while((len=fos.read())!=-1){
fis.write(len);
}
//字节数组
byte[] bytes=new byte[1024];
while((len=fos.read(bytes))!=-1){
fis.write(bytes,0,len);
}
字符流:
FileReader
FileWriter
//缓冲流:
提升运行速度,BufferedInputStream,BufferedOutputStream
new BufferedInputStream(fos)
new BufferedOutputStream(fis)
标签:缓冲流 buffer 缓冲 while stream puts red put 提升
原文地址:https://www.cnblogs.com/god3064371/p/11712277.html