- File file = File.new_for_uri (uri);
- InputStream stream = yield file.read_async (Priority.DEFAULT_IDLE, null);
-
- char[] buf = new char[256*1024];
- size_t nread;
- size_t total = 0;
- while (total < 256*1024) {
- nread = yield stream.read_async ((char *)buf + total, 256*1024 - total, Priority.DEFAULT_IDLE, cancellable);
- total += nread;
- if (cancellable.is_cancelled ())
- return 0;
- if (nread == 0)
- break;
- }
- buf[total] = 0;
- return parse (ref buf);