throw IOException when readings encounter unexcepted end of the stream.