Merge: File no buffered
[nit.git] / lib / core / stream.nit
index 1b610fb..2ecf61b 100644 (file)
@@ -243,7 +243,7 @@ abstract class Reader
                else
                        lookahead_length = 0
                end
-               return rd + raw_read_bytes(bytes, max - rd)
+               return rd + raw_read_bytes(bytes.fast_cstring(rd), max - rd)
        end
 
        # Read a string until the end of the line.
@@ -415,7 +415,11 @@ abstract class Reader
 
        # Is there something to read.
        # This function returns 'false' if there is something to read.
-       fun eof: Bool is abstract
+       fun eof: Bool do
+               if lookahead_length > 0 then return false
+               lookahead_length = raw_read_bytes(lookahead, 1)
+               return lookahead_length <= 0
+       end
 
        # Read the next sequence of non whitespace characters.
        #