FileReader的优势与FileInputStream相比具有优势 [英] FileReader advantages vs. FileInputStream advantages

查看:287
本文介绍了FileReader的优势与FileInputStream相比具有优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我在Stack Overflow上可以看到的内容来看, FileReader 只接受文件, FileInputStream 可以读取所有文件。但是使用 FileReader 有什么好处吗?是否更快?

From what I can read on Stack Overflow, the FileReader only takes files, where the FileInputStream can read all. But is there any advantages in using the FileReader then? Is it faster?

我读到:


FileReader不允许你指定一个编码而不是使用
平台默认编码,这使得它几乎没用,因为使用它时
将导致代码在系统上运行时损坏的数据
具有不同的平台默认值编码。

"FileReader does not allow you to specify an encoding and instead uses the plaform default encoding, which makes it pretty much useless as using it will result in corrupted data when the code is run on systems with different platform default encodings."

但是并没有得到它。平台默认编码是什么意思?

But didn't quite get it. What does platform default encodings mean?

推荐答案

主要区别是:

- 基于字节(读取或写入字节)

读者 - 基于字符(读取或写入字符)

The Main difference is:
Stream - Byte Based(Read or write Bytes)
Reader - Character Based(Read or Write Character)

这篇关于FileReader的优势与FileInputStream相比具有优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆