Disadvantage of FileChannel -> BufferedReader -> Reader

懵懂的女人 提交于 2020-04-10 06:03:55

问题


FileChannel will faster than BufferedReader, BufferedReader will more faster than Reader because FileChannel and BufferedReader has cut off some itermediate steps to receive data.

My question is : the advantage is obvious, but I don't see any source on web say about its disadvantage. (of FileChannel to BufferedReader, BufferedReader to Reader). What a problem when we cut off intermediate steps between.

So, who can teach me,please.

@:And, the same question for Output, too. Please tell me what disadvantage of those.

thanks :)


回答1:


One potential disadvantage when using a BufferedWriter (or any of the other buffered output streams) is the fact that your program holds some data in the buffer/in memory before it is written to the output device. If you cannot afford to lose any data in case of a program crash then you may want consider not to use a BufferedWriter/BufferedOutputStream.




回答2:


I think because when you overcome intermediate steps, data stream will be more easy to meet error. And when errors happen, so difficult to trace bug.



来源:https://stackoverflow.com/questions/9246784/disadvantage-of-filechannel-bufferedreader-reader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!