![]() |
![]() |
![]() |
Camel Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
struct CamelSeekableStream; enum CamelStreamSeekPolicy; #define CAMEL_STREAM_UNBOUND off_t camel_seekable_stream_seek (CamelSeekableStream *stream
,off_t offset
,CamelStreamSeekPolicy policy
); off_t camel_seekable_stream_tell (CamelSeekableStream *stream
); gint camel_seekable_stream_set_bounds (CamelSeekableStream *stream
,off_t start
,off_t end
);
struct CamelSeekableStream { CamelStream parent_object; off_t position; /* current postion in the stream */ off_t bound_start; /* first valid position */ off_t bound_end; /* first invalid position */ };
typedef enum { CAMEL_STREAM_SET = SEEK_SET, CAMEL_STREAM_CUR = SEEK_CUR, CAMEL_STREAM_END = SEEK_END } CamelStreamSeekPolicy;
off_t camel_seekable_stream_seek (CamelSeekableStream *stream
,off_t offset
,CamelStreamSeekPolicy policy
);
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.
|
a CamelStream object |
|
offset value |
|
what to do with the offset |
Returns : |
new position, -1 if operation failed.
|
off_t camel_seekable_stream_tell (CamelSeekableStream *stream
);
Get the current position of a seekable stream.
|
a CamelSeekableStream object |
Returns : |
the current position of the stream. |
gint camel_seekable_stream_set_bounds (CamelSeekableStream *stream
,off_t start
,off_t end
);
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.
|
a CamelSeekableStream object |
|
the first valid position |
|
the first invalid position, or CAMEL_STREAM_UNBOUND |
Returns : |
-1 on error.
|