## CamelSeekableStream CamelSeekableStream |

## Synopsis

                        CamelSeekableStream;
    enum                CamelStreamSeekPolicy;
    #define             CAMEL_STREAM_UNBOUND
    goffset             camel_seekable_stream_seek          (CamelSeekableStream *stream,
                                                             goffset offset,
                                                             CamelStreamSeekPolicy policy,
                                                             GError **error);
    goffset             camel_seekable_stream_tell          (CamelSeekableStream *stream);
    gint                camel_seekable_stream_set_bounds    (CamelSeekableStream *stream,
                                                             goffset start,
                                                             goffset end,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelStream
                   +----CamelSeekableStream
                         +----CamelSeekableSubstream
                         +----CamelStreamFs
                         +----CamelStreamMem

## Description

## Details

### CamelSeekableStream

    typedef struct _CamelSeekableStream CamelSeekableStream;

### enum CamelStreamSeekPolicy

    typedef enum {
    	CAMEL_STREAM_SET = SEEK_SET,
    	CAMEL_STREAM_CUR = SEEK_CUR,
    	CAMEL_STREAM_END = SEEK_END
    } CamelStreamSeekPolicy;

### CAMEL_STREAM_UNBOUND

    #define CAMEL_STREAM_UNBOUND (~0)

### camel_seekable_stream_seek ()

    goffset             camel_seekable_stream_seek          (CamelSeekableStream *stream,
                                                             goffset offset,
                                                             CamelStreamSeekPolicy policy,
                                                             GError **error);

Seek to the specified position in `stream`.

If `policy` is CAMEL_STREAM_SET, seeks to `offset`.

If `policy` is CAMEL_STREAM_CUR, seeks to the current position plus `offset`.

If `policy` is CAMEL_STREAM_END, seeks to the end of the stream plus `offset`.

Regardless of `policy`, the stream's final position will be clamped to the range specified by its lower and upper bounds, and the stream's eos state will be updated.

`stream` : | a CamelStream object
`offset` : | offset value
`policy` : | what to do with the offset
`error` : | return location for a GError, or `NULL`
Returns : | new position, `-1` if operation failed.

### camel_seekable_stream_tell ()

    goffset             camel_seekable_stream_tell          (CamelSeekableStream *stream);

Get the current position of a seekable stream.

`stream` : | a CamelSeekableStream object
Returns : | the current position of the stream.

### camel_seekable_stream_set_bounds ()

    gint                camel_seekable_stream_set_bounds    (CamelSeekableStream *stream,
                                                             goffset start,
                                                             goffset end,
                                                             GError **error);

Set the range of valid data this stream is allowed to cover. If there is to be no `end` value, then `end` should be set to CAMEL_STREAM_UNBOUND.

`stream` : | a CamelSeekableStream object
`start` : | the first valid position
`end` : | the first invalid position, or CAMEL_STREAM_UNBOUND
`error` : | return location for a GError, or `NULL`
Returns : | `-1` on error.