• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the diff between these?  RSS feed

 
Marilyn de Queiroz
Sheriff
Posts: 9082
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream( "text.txt" ) ) );

BufferedReader in = new BufferedReader( new FileReader( "text.txt" ) );

Are they equivalent? How are they different?
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marilyn,
I'm just a beginer in I/O. so i may not be correct. but what i feel is that we'll use first format when our file text.txt is having binary data ( non unicode ).
while second format will be used if text.txt is having data in unicode .
would request others to correct me.
regards
Deekasha
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Marylin,
Actually FileReader extends InputStreamReader and doesn't add any additional fields or methods so, the only real difference is FileReader allows an easier to read implementation.
Hope this helps
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!