JavaUser JavaUser - 1 year ago 100
Java Question

byte stream and character stream

Please explain byte stream and character stream files. What exactly these means , is microsoft word document is byte oriented or character oriented ?


Answer Source

A stream is a way of sequentially accessing a file. A byte stream access the file byte by byte. A byte stream is suitable for any kind of file, however not quite appropriate for text files. For example, if the file is using a unicode encoding and a character is represented with two bytes, the byte stream will treat these separately and you will need to do the conversion yourself.

A character stream will read a file character by character. A character stream needs to be given the file's encoding in order to work properly.

Although a Microsoft Word Document contains text, it can't be accessed with a character stream (it isn't a text file). You need to use a byte stream to access it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download