pengyu1801 发表于 2014-8-18 10:54
flush()是缓冲区必用神器,不是说每个流必须用
郑飞 发表于 2014-8-18 11:06
我就是想知道 FielWriter 中的write(buf,0,len)为什么不用刷新 是不是被封装在哪里了
FileWriter fw ...
pengyu1801 发表于 2014-8-18 12:46
close()方法中自带有刷新功能,所以没写
pengyu1801 发表于 2014-8-18 12:47
如果满意送我点黑马币
思如涌泉 发表于 2014-8-18 12:58
close关闭的时候就附带刷新动作了,将数组刷新到文件中
郑飞 发表于 2014-8-18 12:56
while ((len = fr.read(buf))!=-1)
{
fw.write(buf,0,len);
pengyu1801 发表于 2014-8-18 13:29
前面循环的都缓存起来了
郑飞 发表于 2014-8-18 13:53
好吧 看来我是没弄清楚怎么存进去了 回头我再看看 谢了
烟海 发表于 2014-8-18 22:50
前面循环的。。先相当于临时存到内存一样的容器里面。。。
close之前,全部写入硬盘。。。。 ...
希冀 发表于 2014-8-27 12:21
楼主程序后面是不是用了close方法
冷锋也温柔 发表于 2014-8-31 23:25
没有封装 后面没使用flush() 是因为结尾用close()了 它的作用是刷新内存 后释放资源 它包含 ...
郑飞 发表于 2014-8-18 12:56
while ((len = fr.read(buf))!=-1)
{
fw.write(buf,0,len);
嘻嘻哈哈嘻嘻 发表于 2014-9-16 16:51
这个只是从文件中读出的buf,然后写到内存中,flush()是内存中写到硬盘中
kid1943 发表于 2014-10-7 09:42
其实查看FileWriter类的所有方法(即包括write方法)都继承自父类OutputStreamWriter。
而查看父类OutputSt ...
kid1943 发表于 2014-10-7 09:42
其实查看FileWriter类的所有方法(即包括write方法)都继承自父类OutputStreamWriter。
而查看父类OutputSt ...
kid1943 发表于 2014-10-7 09:42
其实查看FileWriter类的所有方法(即包括write方法)都继承自父类OutputStreamWriter。
而查看父类OutputSt ...
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |