Free the returned object with [gobject.object.ObjectWrap.unref].
File.read
gio.file_input_stream.FileInputStream read(gio.cancellable.Cancellable cancellable = null)Opens a file for reading. The result is a #GFileInputStream that can be used to read the contents of the file.
If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error [gio.types.IOErrorEnum.Cancelled] will be returned.
If the file does not exist, the [gio.types.IOErrorEnum.NotFound] error will be returned. If the file is a directory, the [gio.types.IOErrorEnum.IsDirectory] error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
Parameters
cancellable | a #GCancellable |
Returns
#GFileInputStream or null on error.
Throws
[ErrorWrap]