File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 24187
    
  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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between reader and stream