Replace use of NoSuchElementException with a dedicated EndOfStreamException type