lib/file: move the call of `stdout.set_buffering_mode` to Stdout
[nit.git] / lib / standard / file.nit
index a777028..2f24cb9 100644 (file)
@@ -32,7 +32,7 @@ in "C Header" `{
        #include <errno.h>
 `}
 
-# File Abstract Stream
+# `Stream` used to interact with a File or FileDescriptor
 abstract class FileStream
        super Stream
        # The path of the file.
@@ -63,7 +63,7 @@ abstract class FileStream
        end
 end
 
-# File input stream
+# `Stream` that can read from a File
 class FileReader
        super FileStream
        super BufferedReader
@@ -133,7 +133,7 @@ class FileReader
        end
 end
 
-# File output stream
+# `Stream` that can write to a File
 class FileWriter
        super FileStream
        super Writer
@@ -254,6 +254,7 @@ class Stdout
                _file = new NativeFile.native_stdout
                path = "/dev/stdout"
                _is_writable = true
+               set_buffering_mode(256, sys.buffer_mode_line)
        end
 end
 
@@ -998,10 +999,6 @@ end
 
 redef class Sys
 
-       init do
-               if stdout isa FileStream then stdout.as(FileStream).set_buffering_mode(256, buffer_mode_line)
-       end
-
        # Standard input
        var stdin: PollableReader = new Stdin is protected writable