• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
avani raval
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between character stream and byte stream
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jimmy Die
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic