Name: joT67522 Date: 12/11/97
(See http://java.sun.com/products/jdk/1.1/docs/api/java.io.DataInputStream.html
.)
The class description for java.io.DataInputStream
erroneously specifies a byte of nine bits.
It says:
All characters in the range '\u0001' to '\u007F'
are represented by a single byte:
+-----+----------+
| '0' | bits 0-7 |
+-----+----------+
The prefixed zero plus the eight other bits makes
9 bits, which is not a normal byte.
Additionally, this section is generally ambiguous
and imprecise.
For example, the above description refers to bits
0 through 7 of the encoded Unicode character.
First of all, the documentation never says whether
bits are numbered in big-endian or little-endian
style.
Okay, it is true that the reference "0 to 7",
instead of "7 to 0", implies that you are using
big-endian numbering.
However, if you use big-endian numbering, then
bits 0 to 7 of (16-bit) Unicode characters \u0001
through \u007f are zero, and storing them in the
byte would not be useful.
It is bits 8 through 15 that contain the data you
want. (Or bits 0 through 7 _of_the_low_byte_,
but _not_ of the 16-bit Unicode character itself).)
Yes, in the one-byte case, I can figure out what
you must mean.
However, in the three-byte case, I don't know if
you really mean that the low 4 bits (big-endian-
numbered bits 12-15) are in the first byte, or
if you mean the high 4 bits (little-endian-
numbered 15 to 12).
(Sending the low bits first seems inconsistent
with Java's _style_ of using high-byte-first
network order, but it's not really a contradic-
tion, so I don't know for sure which way bits
are numbered.)
(Review ID: 21802)
======================================================================