问题
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