• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between reader and stream

 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All
What is the difference between reader and stream of java.io ?

Thanks
kundan
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
readers work on Strings, streams on anything.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or more generally: Readers and Writers work with character data and have a notion of a character encoding. The bytes in a file may not match exactly what you get back from a Reader, depending on the active character encoding. If you're working with non-ASCII text, you need to use these or you'll get wrong answers.

Streams, on the other hand, return you byte-for-byte what's in the file, and so are good for binary data with no encoding or translation.
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Ernest
THanks your reply really clears my concept.
THanks again, do you have your book available in INdian edition???

kundan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic