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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 01:01:52  来源:igfitidea点击:

Difference between BufferedReader and BufferedInputStream

javaiojava.util.scannerbufferedreader

提问by user1357722

What are the differences between BufferedReader, BufferedInputStreamand Scannerin java? BufferedReaderreads the text and BufferedInputStreamreads byte. Is there any difference other than this?

java中的BufferedReader,BufferedInputStream和 有什么区别ScannerBufferedReader阅读文本并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

编辑:检查这个问题:读取多字节字符时 InputStream 和 InputStreamReader 的区别

回答by Kumaresh Babu

BufferedInputStreamreads the data in the buffer as bytes by using InputStream. BufferedReaderreads the text but not as bytes and BufferedReaderis efficient reading of characters,arrays and lines.

BufferedInputStream使用 将缓冲区中的数据作为字节读取InputStreamBufferedReader读取文本但不是字节,并且BufferedReader可以有效读取字符、数组和行。