Re: Some questions about the IO package
jtl.zheng wrote:
I read that "So why talk about byte streams? Because all other stream
types are built on byte streams. "
is here "all other stream types" contain char stream?
I'm not an expert, but I think the answer is "Yes, certainly."
To expound on a previous question:
> what I think is:
>
> in char stream
>
> the Reader pick up one char from a local file
> here how many bits "one char" has is decided by the local system
> just as in Windwos "one char" has 8 bits
> and in other system that may has 16bits or 32bits in one char
> and all these bits will turn to 32bits Unicode in java
> this is what the Reader do
> is it correct???
I'm still not an expert, but I think the answer is "no."
On Windows, I've heard that the Java character set is a 16 bit one,
possibly Unicode 1.0. Windows itself uses Unicode 1.0 character set for
certain operations, so this isn't a stretch.
I've also heard that Java on Windows uses some form of variable length
encoding. So for many English characters, yes, a char stream reads one
byte. But some chars maybe be 16 or 24 bits, so some chars may involve
reading multiple bytes.
I honestly have no idea if Java on other systems is localized to a
different character set (maybe 16 bit characters by default), or if it
just adapts other character sets to it's own internal one, so I can't
really tell you what Java does on other systems.