Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileReader advantages vs. FileInputStream advantages

Tags:

java

io

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?

I read that:

"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?

like image 638
user3161344 Avatar asked Jan 04 '14 22:01

user3161344


1 Answers

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

like image 68
Bosko Mijin Avatar answered Sep 18 '22 19:09

Bosko Mijin