Description
Firstly, this eof()
always returns false
. While it is understandable due to the way it has been implemented, this is incorrect behaviour. read(...)
for the same implementation is able to determine when the end-of-file has been reached, and therefore eof()
should be able to as well.
Second, read_byte()
of this implementation will fail
if no data is read from the buffer. While somewhat understandable behaviour, this breaks the use of ReaderUtil::read_line()
, which calls read_byte()
repeatedly until it finds an end-of-line or end-of-file. Looking through other implementations of read_byte()
in io.rs
, it appears that the standard behaviour is to return -1
when end-of-file has been reached. I suggest that we should do the same here, and assume that we have reached the end of the file when no more bytes are read.