nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
stream: Optimize `StringIStream.read_all`
[nit.git]
/
lib
/
standard
/
stream.nit
diff --git
a/lib/standard/stream.nit
b/lib/standard/stream.nit
index
46ad73c
..
ddc01fe
100644
(file)
--- a/
lib/standard/stream.nit
+++ b/
lib/standard/stream.nit
@@
-493,5
+493,12
@@
class StringIStream
source = ""
end
+ redef fun read_all do
+ var c = cursor
+ cursor = source.length
+ if c == 0 then return source
+ return source.substring_from(c)
+ end
+
redef fun eof do return cursor >= source.length
end