File.read

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 gio.cancellable.Cancellable

a #GCancellable

Return Value

Type: gio.file_input_stream.FileInputStream

#GFileInputStream or null on error. Free the returned object with gobject.object.ObjectG.unref.