|  |  |  | GMime 2.4 Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
enum GMimeSeekWhence; GMimeStreamIOVector; GMimeStream; void g_mime_stream_construct (GMimeStream *stream, gint64 start, gint64 end); ssize_t g_mime_stream_read (GMimeStream *stream, char *buf, size_t len); ssize_t g_mime_stream_write (GMimeStream *stream, const char *buf, size_t len); int g_mime_stream_flush (GMimeStream *stream); gint64 g_mime_stream_seek (GMimeStream *stream, gint64 offset, GMimeSeekWhence whence); gint64 g_mime_stream_tell (GMimeStream *stream); int g_mime_stream_reset (GMimeStream *stream); gboolean g_mime_stream_eos (GMimeStream *stream); int g_mime_stream_close (GMimeStream *stream); ssize_t g_mime_stream_length (GMimeStream *stream); GMimeStream * g_mime_stream_substream (GMimeStream *stream, gint64 start, gint64 end); void g_mime_stream_set_bounds (GMimeStream *stream, gint64 start, gint64 end); ssize_t g_mime_stream_write_string (GMimeStream *stream, const char *str); ssize_t g_mime_stream_printf (GMimeStream *stream, const char *fmt, ...); ssize_t g_mime_stream_write_to_stream (GMimeStream *src, GMimeStream *dest); ssize_t g_mime_stream_writev (GMimeStream *stream, GMimeStreamIOVector *vector, size_t count);
GObject +----GMimeStream +----GMimeStreamBuffer +----GMimeStreamCat +----GMimeStreamFile +----GMimeStreamFilter +----GMimeStreamFs +----GMimeStreamMem +----GMimeStreamMmap +----GMimeStreamNull
Streams are the fundamental method for reading and writing data
used by GMime. You'll probably notice that the basic API is similar
to that of the low-level Unix I/O layer (read(), write(), lseek(),
etc) with some additional nicities such as a printf-like function.
typedef enum {
	GMIME_STREAM_SEEK_SET = SEEK_SET,
	GMIME_STREAM_SEEK_CUR = SEEK_CUR,
	GMIME_STREAM_SEEK_END = SEEK_END
} GMimeSeekWhence;
Relative seek position.
typedef struct {
	void *data;
	size_t len;
} GMimeStreamIOVector;
An I/O vector for use with g_mime_stream_writev().
| void * | data to pass to the I/O function. | 
| size_t  | length of the data, in bytes. | 
void g_mime_stream_construct (GMimeStream *stream, gint64 start, gint64 end);
Initializes a new stream with bounds start and end.
| 
 | a GMimeStream | 
| 
 | start boundary | 
| 
 | end boundary | 
ssize_t g_mime_stream_read (GMimeStream *stream, char *buf, size_t len);
Attempts to read up to len bytes from stream into buf.
| 
 | a GMimeStream | 
| 
 | buffer | 
| 
 | buffer length | 
| Returns : | the number of bytes read or -1on fail. | 
ssize_t g_mime_stream_write (GMimeStream *stream, const char *buf, size_t len);
Attempts to write up to len bytes of buf to stream.
| 
 | a GMimeStream | 
| 
 | buffer | 
| 
 | buffer length | 
| Returns : | the number of bytes written or -1on fail. | 
int g_mime_stream_flush (GMimeStream *stream);
Sync's the stream to disk.
| 
 | a GMimeStream | 
| Returns : | 0on success or-1on fail. | 
gint64 g_mime_stream_seek (GMimeStream *stream, gint64 offset, GMimeSeekWhence whence);
Repositions the offset of the stream stream to
the argument offset according to the
directive whence as follows:
    "" Seek offset bytes relative to
    the beginning (bound_start) of the stream.
    "" Seek offset bytes relative to the
    current offset of the stream.
    "" Seek offset bytes relative to the
    end of the stream (bound_end if non-negative).
| 
 | a GMimeStream | 
| 
 | positional offset | 
| 
 | seek directive | 
| Returns : | the resultant position on success or -1on fail. | 
gint64 g_mime_stream_tell (GMimeStream *stream);
Gets the current offset within the stream.
| 
 | a GMimeStream | 
| Returns : | the current position within the stream or -1on fail. | 
int g_mime_stream_reset (GMimeStream *stream);
Resets the stream.
| 
 | a GMimeStream | 
| Returns : | 0on success or-1on fail. | 
gboolean g_mime_stream_eos (GMimeStream *stream);
Tests the end-of-stream indicator for stream.
| 
 | a GMimeStream | 
| Returns : | TRUEon EOS orFALSEotherwise. | 
int g_mime_stream_close (GMimeStream *stream);
Closes the stream.
| 
 | a GMimeStream | 
| Returns : | 0on success or-1on fail. | 
ssize_t g_mime_stream_length (GMimeStream *stream);
Gets the length of the stream.
| 
 | a GMimeStream | 
| Returns : | the length of the stream or -1if unknown. | 
GMimeStream * g_mime_stream_substream (GMimeStream *stream, gint64 start, gint64 end);
Creates a new substream of stream with bounds start and end.
| 
 | a GMimeStream | 
| 
 | start boundary | 
| 
 | end boundary | 
| Returns : | a substream of streamwith boundsstartandend. | 
void g_mime_stream_set_bounds (GMimeStream *stream, gint64 start, gint64 end);
Set the bounds on a stream.
| 
 | a GMimeStream | 
| 
 | start boundary | 
| 
 | end boundary | 
ssize_t g_mime_stream_write_string (GMimeStream *stream, const char *str);
Writes string to stream.
| 
 | a GMimeStream | 
| 
 | string to write | 
| Returns : | the number of bytes written or -1on fail. | 
ssize_t g_mime_stream_printf (GMimeStream *stream, const char *fmt, ...);
Write formatted output to a stream.
| 
 | a GMimeStream | 
| 
 | format | 
| 
 | arguments | 
| Returns : | the number of bytes written or -1on fail. | 
ssize_t g_mime_stream_write_to_stream (GMimeStream *src, GMimeStream *dest);
Attempts to write the source stream to the destination stream.
| 
 | source stream | 
| 
 | destination stream | 
| Returns : | the number of bytes written or -1on fail. | 
ssize_t g_mime_stream_writev (GMimeStream *stream, GMimeStreamIOVector *vector, size_t count);
Writes at most count blocks described by vector to stream.
| 
 | a GMimeStream | 
| 
 | a GMimeStreamIOVector | 
| 
 | number of vector elements | 
| Returns : | the number of bytes written or -1on fail. |