[SPARK-4107] Fix incorrect handling of read() and skip() return values

`read()` may return fewer bytes than requested; when this occurred, the old code would silently return less data than requested, which might cause stream corruption errors.  `skip()` faces similar issues, too.

This patch fixes several cases where we mis-handle these methods' return values.
I was not suggesting your update was inconsistent with the old implementation. I merely pointed out this is a good place to check for more type of errors because the caller is usually not setup to deal with OOM, but it is probably setup to deal with None.