java BufferedReader 和 BufferedInputStream 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10434736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference between BufferedReader and BufferedInputStream
提问by user1357722
What are the differences between BufferedReader
, BufferedInputStream
and Scanner
in java? BufferedReader
reads the text and BufferedInputStream
reads byte
. Is there any difference other than this?
java中的BufferedReader
,BufferedInputStream
和 有什么区别Scanner
?BufferedReader
阅读文本并BufferedInputStream
阅读byte
。除了这个还有什么区别吗?
采纳答案by Igor Deruga
I guess, the difference is the same as between reader and inputstream: one is character-based, another is byte-based. For example, reader normally supports encoding...
我想,阅读器和输入流之间的区别是一样的:一个是基于字符的,另一个是基于字节的。例如,阅读器通常支持编码...
Edit:Check this question: The difference between InputStream and InputStreamReader when reading multi-byte characters
回答by Kumaresh Babu
BufferedInputStream
reads the data in the buffer as bytes by using InputStream
. BufferedReader
reads the text but not as bytes and BufferedReader
is efficient reading of characters,arrays and lines.
BufferedInputStream
使用 将缓冲区中的数据作为字节读取InputStream
。BufferedReader
读取文本但不是字节,并且BufferedReader
可以有效读取字符、数组和行。