GMimeStreamNull

GMimeStreamNull — A null stream

Functions

Types and Values

Description

A GMimeStream which has no real backing storage at all. This stream is useful for dry-runs and can also be useful for determining statistics on source data which can be written to streams but cannot be read as a stream itself (e.g. a GMimeEntity via g_mime_entity_write_to_stream()).

Logical length tracks the highest written position, independently of cumulative byte and newline statistics. Reading is not supported.

Functions

g_mime_stream_null_new ()

GMimeStream *
g_mime_stream_null_new (void);

Creates a new GMimeStreamNull object.

Returns

a new null stream (similar to /dev/null on Unix).


g_mime_stream_null_set_length ()

int
g_mime_stream_null_set_length (GMimeStreamNull *stream,
                               gint64 length);

Sets the logical length without writing bytes. The position is moved to the new end only if it was beyond that end. Cumulative byte and newline statistics are unchanged. For a bounded stream, the end bound is updated to the new length relative to its start bound.

Parameters

stream

a GMimeStreamNull

 

length

the desired measured length, in bytes

 

Returns

0 on success or -1 on failure, with errno set to EINVAL for a negative length or EOVERFLOW if the new end is not representable.


g_mime_stream_null_get_count_newlines ()

gboolean
g_mime_stream_null_get_count_newlines (GMimeStreamNull *stream);

Gets whether or not the stream should keep track of the number of newlines encountered.

Parameters

stream

a GMimeStreamNull

 

Returns

TRUE if the stream should count the number of newlines or FALSE otherwise.


g_mime_stream_null_get_written ()

size_t
g_mime_stream_null_get_written (GMimeStreamNull *stream);

Parameters

stream

a GMimeStreamNull

 

Returns

cumulative bytes written since the last reset.


g_mime_stream_null_get_newlines ()

size_t
g_mime_stream_null_get_newlines (GMimeStreamNull *stream);

Parameters

stream

a GMimeStreamNull

 

Returns

cumulative LF bytes counted since the last reset. Counting must be enabled with g_mime_stream_null_set_count_newlines().


g_mime_stream_null_set_count_newlines ()

void
g_mime_stream_null_set_count_newlines (GMimeStreamNull *stream,
                                       gboolean count);

Sets whether or not the stream should keep track of the number of newlines encountered.

Parameters

stream

a GMimeStreamNull

 

count

TRUE if newlines should be counted or FALSE otherwise

 

Types and Values

GMimeStreamNull

typedef struct _GMimeStreamNull GMimeStreamNull;

A GMimeStream which has no backing store.

See Also

GMimeStream