Class

GioFileIOStream

since: 2.22

Description

class Gio.FileIOStream : Gio.IOStream {
  parent_instance: GIOStream
}

GFileIOStream provides I/O streams that both read and write to the same file handle.

GFileIOStream implements GSeekable, which allows the I/O 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 I/O stream, use g_seekable_tell().

To find out if a file I/O stream supports seeking, use g_seekable_can_seek(). To position a file I/O stream, use g_seekable_seek(). To find out if a file I/O stream supports truncating, use g_seekable_can_truncate(). To truncate a file I/O stream, use g_seekable_truncate().

The default implementation of all the GFileIOStream operations and the implementation of GSeekable just call into the same operations on the output stream.

Available since: 2.22

Ancestors

Implements

Instance methods

g_file_io_stream_get_etag

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.

since: 2.22

g_file_io_stream_query_info

Queries a file io stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_io_stream_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 G_IO_ERROR_PENDING.

since: 2.22

g_file_io_stream_query_info_async

Asynchronously queries the stream for a GFileInfo. When completed, callback will be called with a GAsyncResult which can be used to finish the operation with g_file_io_stream_query_info_finish().

since: 2.22

g_file_io_stream_query_info_finish

Finalizes the asynchronous query started by g_file_io_stream_query_info_async().

since: 2.22

Methods inherited from GIOStream (10)
g_io_stream_clear_pending

Clears the pending flag on stream.

since: 2.22

g_io_stream_close

Closes the stream, releasing resources related to it. This will also close the individual input and output streams, if they are not already closed.

since: 2.22

g_io_stream_close_async

Requests an asynchronous close of the stream, releasing resources related to it. When the operation is finished callback will be called. You can then call g_io_stream_close_finish() to get the result of the operation.

since: 2.22

g_io_stream_close_finish

Closes a stream.

since: 2.22

g_io_stream_get_input_stream

Gets the input stream for this object. This is used for reading.

since: 2.22

g_io_stream_get_output_stream

Gets the output stream for this object. This is used for writing.

since: 2.22

g_io_stream_has_pending

Checks if a stream has pending actions.

since: 2.22

g_io_stream_is_closed

Checks if a stream is closed.

since: 2.22

g_io_stream_set_pending

Sets stream to have actions pending. If the pending flag is already set or stream is closed, it will return FALSE and set error.

since: 2.22

g_io_stream_splice_async

Asynchronously splice the output stream of stream1 to the input stream of stream2, and splice the output stream of stream2 to the input stream of stream1.

since: 2.28

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GSeekable (5)
g_seekable_can_seek

Tests if the stream supports the GSeekableIface.

g_seekable_can_truncate

Tests if the length of the stream can be adjusted with g_seekable_truncate().

g_seekable_seek

Seeks in the stream by the given offset, modified by type.

g_seekable_tell

Tells the current position within the stream.

g_seekable_truncate

Sets the length of the stream to offset. If the stream was previously larger than offset, the extra data is discarded. If the stream was previously shorter than offset, it is extended with NUL (‘\0’) bytes.

Properties

Properties inherited from GIOStream (3)
Gio.IOStream:closed

Whether the stream is closed.

since: 2.22

Gio.IOStream:input-stream

The GInputStream to read from.

since: 2.22

Gio.IOStream:output-stream

The GOutputStream to write to.

since: 2.22

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GioFileIOStreamClass {
  GIOStreamClass parent_class;
  goffset (* tell) (
    GFileIOStream* stream
  );
  gboolean (* can_seek) (
    GFileIOStream* stream
  );
  gboolean (* seek) (
    GFileIOStream* stream,
    goffset offset,
    GSeekType type,
    GCancellable* cancellable,
    GError** error
  );
  gboolean (* can_truncate) (
    GFileIOStream* stream
  );
  gboolean (* truncate_fn) (
    GFileIOStream* stream,
    goffset size,
    GCancellable* cancellable,
    GError** error
  );
  GFileInfo* (* query_info) (
    GFileIOStream* stream,
    const char* attributes,
    GCancellable* cancellable,
    GError** error
  );
  void (* query_info_async) (
    GFileIOStream* stream,
    const char* attributes,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileInfo* (* query_info_finish) (
    GFileIOStream* stream,
    GAsyncResult* result,
    GError** error
  );
  char* (* get_etag) (
    GFileIOStream* stream
  );
  void (* _g_reserved1) (
void
  );
  void (* _g_reserved2) (
void
  );
  void (* _g_reserved3) (
void
  );
  void (* _g_reserved4) (
void
  );
  void (* _g_reserved5) (
void
  );
  
}
No description available.
Class members
parent_class: GIOStreamClass
No description available.
tell: goffset (* tell) ( GFileIOStream* stream )
No description available.
can_seek: gboolean (* can_seek) ( GFileIOStream* stream )
No description available.
seek: gboolean (* seek) ( GFileIOStream* stream, goffset offset, GSeekType type, GCancellable* cancellable, GError** error )
No description available.
can_truncate: gboolean (* can_truncate) ( GFileIOStream* stream )
No description available.
truncate_fn: gboolean (* truncate_fn) ( GFileIOStream* stream, goffset size, GCancellable* cancellable, GError** error )
No description available.
query_info: GFileInfo* (* query_info) ( GFileIOStream* stream, const char* attributes, GCancellable* cancellable, GError** error )
No description available.
query_info_async: void (* query_info_async) ( GFileIOStream* stream, const char* attributes, int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )
No description available.
query_info_finish: GFileInfo* (* query_info_finish) ( GFileIOStream* stream, GAsyncResult* result, GError** error )
No description available.
get_etag: char* (* get_etag) ( GFileIOStream* stream )
No description available.
_g_reserved1: void (* _g_reserved1) ( void )
No description available.
_g_reserved2: void (* _g_reserved2) ( void )
No description available.
_g_reserved3: void (* _g_reserved3) ( void )
No description available.
_g_reserved4: void (* _g_reserved4) ( void )
No description available.
_g_reserved5: void (* _g_reserved5) ( void )
No description available.

Virtual methods

Gio.FileIOStreamClass.can_seek
No description available.

Gio.FileIOStreamClass.can_truncate
No description available.

Gio.FileIOStreamClass.get_etag

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.

since: 2.22

Gio.FileIOStreamClass.query_info

Queries a file io stream for the given attributes. This function blocks while querying the stream. For the asynchronous version of this function, see g_file_io_stream_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 G_IO_ERROR_PENDING.

since: 2.22

Gio.FileIOStreamClass.query_info_async

Asynchronously queries the stream for a GFileInfo. When completed, callback will be called with a GAsyncResult which can be used to finish the operation with g_file_io_stream_query_info_finish().

since: 2.22

Gio.FileIOStreamClass.query_info_finish

Finalizes the asynchronous query started by g_file_io_stream_query_info_async().

since: 2.22

Gio.FileIOStreamClass.seek
No description available.

Gio.FileIOStreamClass.tell
No description available.

Gio.FileIOStreamClass.truncate_fn
No description available.