core :: Reader :: read_all_bytes
The content of the file is returned verbatim.
# Read all the stream until the eof.
#
# The content of the file is returned verbatim.
fun read_all_bytes: Bytes
do
if last_error != null then return new Bytes.empty
var s = new Bytes.empty
var buf = new CString(4096)
while not eof do
var rd = read_bytes_to_cstring(buf, 4096)
s.append_ns(buf, rd)
end
return s
end
lib/core/stream.nit:354,2--367,4
redef fun read_all_bytes
do
var res = bytes.slice_from(cursor)
cursor = bytes.length
return res
end
lib/core/stream.nit:723,2--728,4