[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.
Ah, gotcha.

From a general API design perspective, I think it's a little weird to have methods that swallow OOMs and resurface them as other errors.  As a library consumer, how would you feel if, say, Snappy were to swallow OOMs and re-throw them as IOException?  A library with that sort of unexpected behavior might actually break user applications' ability to recover from OOMs: if we ran out of memory due to excessive memory usage in some other part of the app but the OOM happened to be caught and swallowed by the library, then the top-level uncaught exception handler might never get a chance to respond to the OOM in an application-specific way (e.g. attempt to close files, trigger GCs, or clear caches).

I'm not against handling OOMs in principle, but I think that it should probably be done at higher levels of the stack since that seems easier to reason about.