[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.
ok you convinced me on this one.

are there any other type of exceptions (not errors) that can be thrown? we shouldn't throw a random exception when the implicit contract of the api is already None - if it fails?