Top | ![]() |
![]() |
![]() |
![]() |
GSeekable is implemented by GFileIOStream, GFileInputStream, GFileOutputStream, GMemoryInputStream and GMemoryOutputStream.
GSeekable is implemented by streams (implementations of GInputStream or GOutputStream) that support seeking.
goffset
g_seekable_tell (GSeekable *seekable
);
Tells the current position within the stream.
gboolean
g_seekable_can_seek (GSeekable *seekable
);
Tests if the stream supports the GSeekableIface.
gboolean g_seekable_seek (GSeekable *seekable
,goffset offset
,GSeekType type
,GCancellable *cancellable
,GError **error
);
Seeks in the stream by the given offset
, modified by type
.
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 G_IO_ERROR_CANCELLED
will be returned.
gboolean
g_seekable_can_truncate (GSeekable *seekable
);
Tests if the stream can be truncated.
gboolean g_seekable_truncate (GSeekable *seekable
,goffset offset
,GCancellable *cancellable
,GError **error
);
Truncates a stream with a given offset.
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 G_IO_ERROR_CANCELLED
will be returned. If an
operation was partially finished when the operation was cancelled the
partial result will be returned, without an error.
Virtual: truncate_fn
struct GSeekableIface { GTypeInterface g_iface; /* Virtual Table */ goffset (* tell) (GSeekable *seekable); gboolean (* can_seek) (GSeekable *seekable); gboolean (* seek) (GSeekable *seekable, goffset offset, GSeekType type, GCancellable *cancellable, GError **error); gboolean (* can_truncate) (GSeekable *seekable); gboolean (* truncate_fn) (GSeekable *seekable, goffset offset, GCancellable *cancellable, GError **error); /* TODO: Async seek/truncate */ };
Provides an interface for implementing seekable functionality on I/O Streams.
GTypeInterface |
The parent interface. |
|
Tells the current location within a stream. |
||
Checks if seeking is supported by the stream. |
||
Seeks to a location within a stream. |
||
Checks if truncation is supported by the stream. |
||
Truncates a stream. |