Forums Register Login

InputStreamReader!!

+Pie Number of slices to send: Send
hi folks,
i found the following about the InputStreamReader:
[B]
[/B]
i don't really understand when it says from bytes to characters.is it true that everything written in console is byte that needs to be converted in characters like shown in above code snippet? it would be great help if you explain me this concept in layman's term.
thanks.
[ July 07, 2003: Message edited by: Namaste Sathi ]
+Pie Number of slices to send: Send
hi sathi
here is what i understand.
Byte streams can work with any streams (as anything essentially is a byte format).
Character streams is a easy way of handling data "if we know the data is character data".
e.g.
- if we wonna read image then we don't use Character stream as u can't really print image the way u 'd display characters, right?
- if we wonna read a file that has some user data which is a text then we use Character stream rather than the Byte stream to have greater advantage of methods like readLine() and things...
now, when we need InputStreamReader()???
when the input source can't be predicted till runtime the API methods (java api or custom api) can return byte stream object as we can read any data with byte streams BUT if we know (being in specific application) that the input is always a file having ascii characters then we can use InputStreamReader as bridge b/w byte stream that we get from the API method and the Readers we have in our code to deal input data as characters.
regards
maulin
You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1162 times.
Similar Threads
io conceptual query
Is there any need to close the streams which are opened while executing a process?
java io question, conceptual query
the exec command is not able to deal with space some time
system.in.read()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:42:33.