| GIO Reference Manual | ||||
|---|---|---|---|---|
#include <gio/gio.h>
GSeekable;
GSeekableIface;
goffset g_seekable_tell (GSeekable *seekable);
gboolean g_seekable_can_seek (GSeekable *seekable);
gboolean g_seekable_seek (GSeekable *seekable,
goffset offset,
GSeekType type,
GCancellable *cancellable,
GError **error);
gboolean g_seekable_can_truncate (GSeekable *seekable);
gboolean g_seekable_truncate (GSeekable *seekable,
goffset offset,
GCancellable *cancellable,
GError **error);
GSeekable is implemented by GFileOutputStream, GMemoryInputStream, GMemoryOutputStream and GFileInputStream.
GSeekable is implemented by streams (implementations of GInputStream or GOutputStream) that support seeking.
typedef struct {
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 */
} GSeekableIface;
Provides an interface for implementing seekable functionality on I/O Streams.
g_iface; |
The parent interface. |
tell () |
Tells the current location within a stream. |
can_seek () |
Checks if seeking is supported by the stream. |
seek () |
Seeks to a location within a stream. |
can_truncate () |
Chekcs if truncation is suppored by the stream. |
truncate_fn () |
Truncates a stream. |
goffset g_seekable_tell (GSeekable *seekable);
Tells the current position within the stream.
seekable : |
a GSeekable. |
| Returns : | the offset from the beginning of the buffer. |
gboolean g_seekable_can_seek (GSeekable *seekable);
Tests if the stream supports the GSeekableIface.
seekable : |
a GSeekable. |
| Returns : | TRUEseekable can be seeked. FALSE |
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 NULLG_IO_ERROR_CANCELLED will be returned.
seekable : |
a GSeekable. |
offset : |
a |
type : |
a |
cancellable : |
optional GCancellable object, NULL |
error : |
a NULL |
| Returns : | TRUEFALSEerror
appropriately if present.
|
gboolean g_seekable_can_truncate (GSeekable *seekable);
Tests if the stream can be truncated.
seekable : |
a GSeekable. |
| Returns : | TRUEFALSE |
gboolean g_seekable_truncate (GSeekable *seekable,goffset offset, GCancellable *cancellable,GError **error);
Truncates a stream with a given
If cancellable is not NULLG_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.
seekable : |
a GSeekable. |
offset : |
a |
cancellable : |
optional GCancellable object, NULL |
error : |
a NULL |
| Returns : | TRUEFALSEerror
appropriately if present.
|