# gio.Seekable

Stream seeking interface.

## Synopsis

gio.Seekable
gobject.GInterface
tell
can_seek
seek
offset
type
0
cancellable
None
can_truncate
truncate
offset
cancellable
None

## Ancestry

    +-- gobject.GInterface
      +-- gio.Seekable

## 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

                    tell

Returns :

  the offset from the beginning of the buffer

Tells the current position within the stream.

### gio.Seekable.can_seek

                    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

                    seek
                    offset
                    type0
                    cancellableNone

`offset` :

  the offset that is added to the position determined by the `type` parameter.

`type` :

  0=current position, 1=start of the file, 2=end of the file.

`cancellable` :

  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

                    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

                    truncate
                    offset
                    cancellableNone

`offset` :

  the offset at which the stream should be truncated

`cancellable` :

  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.