gio.Seekable
gio.Seekable — Stream seeking interface.
Synopsis
class gio.Seekable(gobject.GInterface): |
Known Implementation
gio.Seekable is implemented by
gio.FileOutputStream,
gio.MemoryInputStream,
gio.FileInputStream and
gio.MemoryOutputStream.
Description
gio.Seekable
is implemented by streams (implementations of
gio.InputStream or
gio.OutputStream)
that support seeking.
Methods
gio.Seekable.tell
def tell()Returns : | the offset from the beginning of the buffer |
Tells the current position within the stream.
gio.Seekable.can_seek
def can_seek()Returns : | True if this
gio.Seekable can be seeked with
the seek() method, False
if not. |
The can_seek() method checks if the
seek()
can be used on this gio.Seekable.
gio.Seekable.seek
def seek(offset, type=0, cancellable=None)
| the offset that is added to the position determined by the type parameter.
|
| 0=current position, 1=start of the file, 2=end of the file. |
| a gio.Cancellable
or None. |
Returns : | True on successful seek,
False otherwise.
|
Seeks in the stream by the given offset, modified by type.
If cancellable is not None, then the
operation can be cancelled by triggering the cancellable object from another thread.
gio.Seekable.can_truncate
def can_truncate()Returns : | True if this
gio.Seekable can be truncated with
the truncate() method, False
if not. |
The can_truncate() method checks if the
truncate()
can be used on this gio.Seekable.
gio.Seekable.truncate
def truncate(offset, cancellable=None)
| the offset at which the stream should be truncated |
| a gio.Cancellable
or None. |
Returns : | True if successful,
False otherwise.
|
Truncates a stream with a given offset.
If cancellable is not None, then the
operation can be cancelled by triggering the cancellable object from another thread.
If an operation was partially finished when the operation was cancelled the partial result will be returned, without an error.
