ENH: Add file buffer validation to I/O ops
1) Allows for more uniform handling of invalid file buffers to our `read_*` functions.
2) Adds a ton of new documentation to `inference.py`

Closes #15337.

Partially addresses #15895.