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?
Asked
Active
Viewed 2.0k times
25
![](../../users/profiles/3151210.webp)
Ashish Kumar
- 816
- 2
- 14
- 31
![](../../users/profiles/1357722.webp)
user1357722
- 5,598
- 12
- 32
- 41
-
Please, check this http://docs.oracle.com/javase/tutorial/essential/io/index.html – Paul Vargas May 03 '12 at 15:41
-
possible duplicate of [inputstream and reader in Java IO](http://stackoverflow.com/questions/5764065/inputstream-and-reader-in-java-io) – skaffman May 03 '12 at 16:45
-
1Scanner is almost the same as any reader, but it has a lot of methods for parsing input and it's not thread safe – Kirill Bazarov Apr 22 '14 at 13:43
2 Answers
18
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
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/562970.webp)
Igor Deruga
- 1,452
- 1
- 10
- 17
9
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.
![](../../users/profiles/3151210.webp)
Ashish Kumar
- 816
- 2
- 14
- 31
![](../../users/profiles/3728751.webp)
Kumaresh Babu
- 91
- 1
- 1