When an I/O stream manages 8-bit bytes of raw binary data, it is called a byte stream. And, when the I/O stream manages 16-bit Unicode characters, it is called a character stream.
Byte stream
is clear. It uses 8-bit bytes. So if I were to write a character that uses 3 bytes it would only write its last 8 bits! Thus making incorrect output.
So that is why we use character streams
. Say I want to write Latin Capital Letter Ạ
. I would need 3 bytes for storing in UTF-8. But say I also want to store 'normal' A
. Now it would take 1 byte to store.
Are you seeing pattern? We can't know how much bytes it will take for writing any of these characters until we convert them. So my question is why is it said that character streams manage 16-bit Unicode characters
? When in case where I wrote Ạ
that takes 3 bytes it didn't cut it to last 16-bits like byte streams
cut last 8-bits. What does that quote even mean then?