The readShort and readInt methods call:
if (read(byteBuf, 0, 2) < 0) {
throw new EOFException();
}
and
if (read(byteBuf, 0, 4) < 0) {
throw new EOFException();
}
respectively. However, for readShort, if only a single byte is left, or for
readInt, if less than 4 bytes are left, the code that follows will use
incorrect values from the byteBuf array.
|