if (mLength <= 0) {
return -1;
} else if (byteCount > mLength) {
byteCount = (int) mLength;
}
final int n = mWrapped.read(buffer, byteOffset, byteCount);
if (n == -1) {
if (mLength > 0) {
throw new IOException("Unexpected EOF; expected " + mLength + " more bytes");
}
} else {
mLength -= n;
}
return n;