Gio.FileIOStream

g GObject.GInterface GObject.GInterface Gio.Seekable Gio.Seekable GObject.GInterface->Gio.Seekable GObject.Object GObject.Object Gio.IOStream Gio.IOStream GObject.Object->Gio.IOStream Gio.FileIOStream Gio.FileIOStream Gio.IOStream->Gio.FileIOStream Gio.Seekable->Gio.FileIOStream

Subclasses:None

Methods

Inherited:Gio.IOStream (11), GObject.Object (37), Gio.Seekable (5)
Structs:GObject.ObjectClass (5)
  get_etag ()
  query_info (attributes, cancellable)
  query_info_async (attributes, io_priority, cancellable, callback, *user_data)
  query_info_finish (result)

Virtual Methods

Inherited:Gio.IOStream (5), GObject.Object (7), Gio.Seekable (5)
  do_can_seek ()
  do_can_truncate ()
  do_get_etag ()
  do_query_info (attributes, cancellable)
  do_query_info_async (attributes, io_priority, cancellable, callback, *user_data)
  do_query_info_finish (result)
  do_seek (offset, type, cancellable)
  do_tell ()
  do_truncate_fn (size, cancellable)

Properties

Inherited:Gio.IOStream (3)

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance Gio.IOStream r  
priv Gio.FileIOStreamPrivate r  

Class Details

class Gio.FileIOStream(**kwargs)
Bases:Gio.IOStream, Gio.Seekable
Abstract:No
Structure:Gio.FileIOStreamClass

Gio.FileIOStream provides io streams that both read and write to the same file handle.

Gio.FileIOStream implements Gio.Seekable, which allows the io stream to jump to arbitrary positions in the file and to truncate the file, provided the filesystem of the file supports these operations.

To find the position of a file io stream, use Gio.Seekable.tell().

To find out if a file io stream supports seeking, use Gio.Seekable.can_seek(). To position a file io stream, use Gio.Seekable.seek(). To find out if a file io stream supports truncating, use Gio.Seekable.can_truncate(). To truncate a file io stream, use Gio.Seekable.truncate().

The default implementation of all the Gio.FileIOStream operations and the implementation of Gio.Seekable just call into the same operations on the output stream.

New in version 2.22.

get_etag()[source]
Returns:the entity tag for the stream.
Return type:str

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

New in version 2.22.

query_info(attributes, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

a Gio.FileInfo for the self, or None on error.

Return type:

Gio.FileInfo

Queries a file io stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see Gio.FileIOStream.query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with Gio.IOErrorEnum.PENDING.

Can fail if the stream was already closed (with error being set to Gio.IOErrorEnum.CLOSED), the stream has pending operations (with error being set to Gio.IOErrorEnum.PENDING), or if querying info is not supported for the stream’s interface (with error being set to Gio.IOErrorEnum.NOT_SUPPORTED). I all cases of failure, None will be returned.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be set, and None will be returned.

New in version 2.22.

query_info_async(attributes, io_priority, cancellable, callback, *user_data)[source]
Parameters:

Asynchronously queries the self for a Gio.FileInfo. When completed, callback will be called with a Gio.AsyncResult which can be used to finish the operation with Gio.FileIOStream.query_info_finish().

For the synchronous version of this function, see Gio.FileIOStream.query_info().

New in version 2.22.

query_info_finish(result)[source]
Parameters:result (Gio.AsyncResult) – a Gio.AsyncResult.
Raises:GLib.Error
Returns:A Gio.FileInfo for the finished query.
Return type:Gio.FileInfo

Finalizes the asynchronous query started by Gio.FileIOStream.query_info_async().

New in version 2.22.

do_can_seek() virtual
Return type:bool
do_can_truncate() virtual
Return type:bool
do_get_etag() virtual
Returns:the entity tag for the stream.
Return type:str

Gets the entity tag for the file when it has been written. This must be called after the stream has been written and closed, as the etag can change while writing.

New in version 2.22.

do_query_info(attributes, cancellable) virtual
Parameters:
Returns:

a Gio.FileInfo for the stream, or None on error.

Return type:

Gio.FileInfo

Queries a file io stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see Gio.FileIOStream.query_info_async(). While the stream is blocked, the stream will set the pending flag internally, and any other operations on the stream will fail with Gio.IOErrorEnum.PENDING.

Can fail if the stream was already closed (with error being set to Gio.IOErrorEnum.CLOSED), the stream has pending operations (with error being set to Gio.IOErrorEnum.PENDING), or if querying info is not supported for the stream’s interface (with error being set to Gio.IOErrorEnum.NOT_SUPPORTED). I all cases of failure, None will be returned.

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be set, and None will be returned.

New in version 2.22.

do_query_info_async(attributes, io_priority, cancellable, callback, *user_data) virtual
Parameters:

Asynchronously queries the stream for a Gio.FileInfo. When completed, callback will be called with a Gio.AsyncResult which can be used to finish the operation with Gio.FileIOStream.query_info_finish().

For the synchronous version of this function, see Gio.FileIOStream.query_info().

New in version 2.22.

do_query_info_finish(result) virtual
Parameters:result (Gio.AsyncResult) – a Gio.AsyncResult.
Returns:A Gio.FileInfo for the finished query.
Return type:Gio.FileInfo

Finalizes the asynchronous query started by Gio.FileIOStream.query_info_async().

New in version 2.22.

do_seek(offset, type, cancellable) virtual
Parameters:
Return type:

bool

do_tell() virtual
Return type:int
do_truncate_fn(size, cancellable) virtual
Parameters:
Return type:

bool