用Java读取数据
使用 BufferedReader
和 BufferedInputStream
有什么区别?
What's the difference between using a BufferedReader
and a BufferedInputStream
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
BufferedReader
用于读取字符数据。BufferedOutputStream
用于写入二进制数据。继承自
Reader
< 的任何类/a> 或Writer
< /a> 处理 16 位 unicode 字符数据,而从InputStream
或OutputStream
涉及处理二进制数据。类InputStreamReader
和OutputStreamWriter
可用于桥接两类数据。A
BufferedReader
is used for reading character data. ABufferedOutputStream
is used for writing binary data.Any classes inheriting from
Reader
orWriter
deal with 16-bit unicode character data, whereas classes inherting fromInputStream
orOutputStream
are concerned with processing binary data. The classesInputStreamReader
andOutputStreamWriter
can be used to bridge between the two classes of data.Bufferedreader 从文件中以字符串形式读取数据。 BufferedOutputStream 以字节为单位写入文件。 BufferedInputStream 以字节为单位读取数据
Bufferedreader 的示例:
BufferedOutputStream 的示例:
Bufferedinputstream 以字节读取:
样本
:
Bufferedreader reads data from a file as a string. BufferedOutputStream writes to a file in bytes. BufferedInputStream reads data in bytes
Sample to Bufferedreader:
Sample to BufferedOutputStream:
Bufferedinputstream reads in byte:
Sample
:
顾名思义,一个是读取数据,另一个是输出数据。
As the names imply, one is for reading data, and the other is for outputting data.