wood burning stoves 2.0*
The moose likes Java in General and the fly likes difference between reader and stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "difference between reader and stream" Watch "difference between reader and stream" New topic
Author

difference between reader and stream

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
HI All
What is the difference between reader and stream of java.io ?

Thanks
kundan


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
readers work on Strings, streams on anything.


42
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
HI Ernest
THanks your reply really clears my concept.
THanks again, do you have your book available in INdian edition???

kundan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: difference between reader and stream
 
Similar Threads
Data Stream and Byte Stream
what is the difference between Byte and Stream?6
what is the difference between stream classes and reader,writer classes
java/input-output stream
What is the diff. between character-stream and byte stream which one is better?why?