31

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?

Ashish Kumar
  • 916
  • 2
  • 15
  • 32
user1357722
  • 7,088
  • 13
  • 34
  • 43
  • 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
  • 1
    Scanner is almost the same as any reader, but it has a lot of methods for parsing input and it's not thread safe –  Apr 22 '14 at 13:43

2 Answers2

20

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

Community
  • 1
  • 1
Igor Deruga
  • 1,504
  • 1
  • 10
  • 18
11

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.

Ashish Kumar
  • 916
  • 2
  • 15
  • 32
Kumaresh Babu
  • 111
  • 1
  • 2