aspose file tools*
The moose likes Java in General and the fly likes What is the diff. between character-stream and byte stream which one is better?why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is the diff. between character-stream and byte stream which one is better?why?" Watch "What is the diff. between character-stream and byte stream which one is better?why?" New topic
Author

What is the diff. between character-stream and byte stream which one is better?why?

avani raval
Greenhorn

Joined: Jul 20, 2005
Posts: 1
what is the difference between character stream and byte stream
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I am not entirely sure what you are referring to here. Java does not contain any classes called CharacterStream or ByteStream. Can you provide some more context for your question? Where did you hear (or read) these terms being used?

Layne


Java API Documentation
The Java Tutorial
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Hi,

Maybe you are referring to the buffers. If so read more on this, try reading the java.nio.*; package ByteBuffer class and the methods in this class.


Jimmy Die
KasiMurugan Ramasamy
Ranch Hand

Joined: Jan 30, 2005
Posts: 125
Hi,
Some differences are there.

Byte Stream : Bytes stream reads or writes the data as byte( reads as combination 0s and 1s ) from the underlying stream. Such a underlying streams are Socket or file.

Character Stream : It reads or writes the data as character. But interanally it reads the bytes and converting into a character.

Bytes Stream:
============
It would be very useful when reading the file or socket and write into another sockets or file. ( Don't need of conversion, but incase of if we use character stream, it needs conversion in both operations)

Character Stream:
=================
It would be veryuseful when reading the data and directly so it into user. ( User can understand only combination of character). So that we don't need to explicit conversion from byte into character.

Guys Please correct me incase of any wrong conceptions.

I hope you will get me.


Thanks & Regards
Kasimurugan (SCJP1.4, SCBCD1.3), Preparing SCWCD1.4
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is the diff. between character-stream and byte stream which one is better?why?