lib: move some examples/* into specific subdirectories of their lib
[nit.git] / lib / standard / stream.nit
index a94601c..6b70e21 100644 (file)
@@ -202,7 +202,7 @@ abstract class BufferedIStream
                        var j = _buffer_pos
                        var k = _buffer.length
                        while j < k do
-                               s.add(_buffer.chars[j])
+                               s.add(_buffer[j])
                                j += 1
                        end
                        _buffer_pos = j
@@ -250,10 +250,10 @@ abstract class BufferedIStream
        redef fun eof do return _buffer_pos >= _buffer.length and end_reached
 
        # The buffer
-       var _buffer: nullable FlatBuffer = null
+       private var buffer: nullable FlatBuffer = null
 
        # The current position in the buffer
-       var _buffer_pos: Int = 0
+       private var buffer_pos: Int = 0
 
        # Fill the buffer
        protected fun fill_buffer is abstract
@@ -288,8 +288,6 @@ abstract class FDStream
        private fun native_read(i: Int, buf: NativeString, len: Int): Int is extern "stream_FDStream_FDStream_native_read_3"
        private fun native_write(i: Int, buf: NativeString, len: Int): Int is extern "stream_FDStream_FDStream_native_write_3"
        private fun native_write_char(i: Int, c: Char): Int is extern "stream_FDStream_FDStream_native_write_char_2"
-
-       init(fd: Int) do self.fd = fd
 end
 
 class FDIStream
@@ -303,36 +301,24 @@ class FDIStream
                if nb == -1 then eof = true
                return nb
        end
-
-       init(fd: Int) do end 
 end
 
 class FDOStream
        super FDStream
        super OStream
-       redef var is_writable: Bool
+       redef var is_writable = true
 
        redef fun write(s)
        do
                var nb = native_write(fd, s.to_cstring, s.length)
                if nb < s.length then is_writable = false
        end
-
-       init(fd: Int)
-       do
-               is_writable = true
-       end
 end
 
 class FDIOStream
        super FDIStream
        super FDOStream
        super IOStream
-       init(fd: Int)
-       do
-               self.fd = fd
-               is_writable = true
-       end
 end
 
 redef interface Object