FileChannel 的缺点 -> BufferedReader->读者
FileChannel
比 BufferedReader
更快,BufferedReader
比 Reader
更快,因为 FileChannel
和BufferedReader
切断了一些接收数据的中间步骤。
我的问题是:优点是显而易见的,但我在网络上没有看到任何资料说明其缺点。 (FileChannel
到 BufferedReader
、BufferedReader
到 Reader
)。当我们切断之间的中间步骤时,这是多么大的问题啊。
那么请问谁可以教我一下。
@:而且,输出也有同样的问题。请告诉我这些有什么缺点。
谢谢 :)
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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 BufferedWriter(或任何其他缓冲输出流)时的一个潜在缺点是,您的程序在将某些数据写入输出设备之前将其保存在缓冲区/内存中。如果您无法承受在程序崩溃时丢失任何数据的损失,那么您可能需要考虑不使用
BufferedWriter
/BufferedOutputStream
。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 aBufferedWriter
/BufferedOutputStream
.我认为因为当你克服中间步骤时,数据流将更容易遇到错误。当错误发生时,很难追踪错误。
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.