Incorrect data returned by ClassReader.readStream
When the class size is less than the minimum buffer size, the data array which is returned by 'readStream' is longer than the actual number of bytes which were read.
For non-valid classes (in particular, those which are truncated), this leads to misleading failures. Instead of failing to obtain a next byte from the data array, an unusual value will be obtained from the data array, leading to a failure unrelated to the root problem of retrieving of a data byte beyond the actual read data.
A potential fix would be to change this check in 'readStream':
From:
if ( readCount == 1 ) {
To:
if ( (readCount == 1) && (bytesRead == bufferSize) ) {