The CodedInputStream(byte[], int, int), the setting of: bufferSize = *off+ *
len;
would appear to be an error. I expect it should be: bufferSize = len;
(generally, bufferSize is the max value of bufferPos in the buffer byte[])
This leads to various confusion and ArrayIndexOutOfBoundsException when
using a byte[] slice.
For example: CodedInputStream.newInstance("AAAAA".getBytes(),
5,5).isAtEnd() --> *false* [when obviously the buffer is 'empty' at this
point]
and readBytes() will likewise expect to find more bytes than are actually
in the byte[]
Note: There are other inconsistencies (wrt bufferSize & totalBytesRetired)
in refillBuffer, where bufferSize is not what it seems (when using a byte[]
slice)