core/io: add BoundedFileReader for operating on just a part of the input