stdlib/strings: Moved Buffer to FlatBuffer, Buffer is now abstract.
[nit.git] / lib / standard / stream.nit
index 745064a..d26d95f 100644 (file)
@@ -37,7 +37,7 @@ interface IStream
        # Read at most i bytes
        fun read(i: Int): String
        do
-               var s = new Buffer.with_capacity(i)
+               var s = new FlatBuffer.with_capacity(i)
                while i > 0 and not eof do
                        var c = read_char
                        if c >= 0 then
@@ -52,7 +52,7 @@ interface IStream
        fun read_line: String
        do
                assert not eof
-               var s = new Buffer
+               var s = new FlatBuffer
                append_line_to(s)
                return s.to_s
        end
@@ -60,7 +60,7 @@ interface IStream
        # Read all the stream until the eof.
        fun read_all: String
        do
-               var s = new Buffer
+               var s = new FlatBuffer
                while not eof do
                        var c = read_char
                        if c >= 0 then s.add(c.ascii)
@@ -117,7 +117,7 @@ abstract class BufferedIStream
 
        redef fun read(i)
        do
-               var s = new Buffer.with_capacity(i)
+               var s = new FlatBuffer.with_capacity(i)
                var j = _buffer_pos
                var k = _buffer.length
                while i > 0 do
@@ -139,7 +139,7 @@ abstract class BufferedIStream
 
        redef fun read_all
        do
-               var s = new Buffer
+               var s = new FlatBuffer
                while not eof do
                        var j = _buffer_pos
                        var k = _buffer.length
@@ -192,7 +192,7 @@ abstract class BufferedIStream
        redef fun eof do return _buffer_pos >= _buffer.length and end_reached
 
        # The buffer
-       var _buffer: nullable Buffer = null
+       var _buffer: nullable FlatBuffer = null
 
        # The current position in the buffer
        var _buffer_pos: Int = 0
@@ -206,7 +206,7 @@ abstract class BufferedIStream
        # Allocate a `_buffer` for a given `capacity`.
        protected fun prepare_buffer(capacity: Int)
        do
-               _buffer = new Buffer.with_capacity(capacity)
+               _buffer = new FlatBuffer.with_capacity(capacity)
                _buffer_pos = 0 # need to read
        end
 end