Add Read_all() for FileStream
I was doing the advent of code in vala when I needed to get all the text in a string at once and that's when I got the idea to add a read_all() for the FileStream object.
So I did :
public string? read_all (int32 buffer_size=8192) {
string text = "";
char []buf = new char[buffer_size];
while (gets ((char[])buf) != null) {
text += (string)buf;
}
return (text);
}
it's in the 4000 lines or so in glib-2.0.vapi just before the read_line() function;
I tested in doubt with a big file, a 0byte file, a 1 byte file, a small file, STDOUT, STDIN, STDERR. everything works if there is a need to add optimization requested I can try. I can also do merge request if needed thanks
(by the way I didn't understand how to add comments for valadoc)
Edited by Hydral Nathan Jordan