| Top |
| GMimeStream * | g_mime_stream_mem_new () |
| GMimeStream * | g_mime_stream_mem_new_with_byte_array () |
| GMimeStream * | g_mime_stream_mem_new_with_buffer () |
| GByteArray * | g_mime_stream_mem_get_byte_array () |
| void | g_mime_stream_mem_set_byte_array () |
| gboolean | g_mime_stream_mem_get_owner () |
| void | g_mime_stream_mem_set_owner () |
A simple GMimeStream implementation that uses a memory buffer for storage. Substreams retain the shared byte array independently of their parent. Closing or replacing a parent's buffer does not invalidate them. Logical positions and bounds remain independent.
A finite length describes the declared range, even if the buffer is shorter. Reads stop at the actual allocation; writes grow it safely. Bounded writes retain native partial-write behavior at the end bound.
GMimeStream *
g_mime_stream_mem_new (void);
Creates a new GMimeStreamMem object.
GMimeStream *
g_mime_stream_mem_new_with_byte_array (GByteArray *array);
Creates a new GMimeStreamMem with data array
.
GMimeStream * g_mime_stream_mem_new_with_buffer (const char *buffer,size_t len);
Creates a new GMimeStreamMem object and initializes the stream
contents with the first len
bytes of buffer
.
a new memory stream initialized with buffer
,
or NULL with errno set to EOVERFLOW if len
exceeds G_MAXUINT.
[nullable]
GByteArray *
g_mime_stream_mem_get_byte_array (GMimeStreamMem *mem);
Gets the byte array from the memory stream.
void g_mime_stream_mem_set_byte_array (GMimeStreamMem *mem,GByteArray *array);
Sets the byte array on the memory stream. Existing substreams continue to use the previous array. Reassigning the same array is safe and still resets the position and bounds.
Note: The memory stream is not responsible for freeing the byte
array. Use g_mime_stream_mem_set_owner() to change this behavior.
A substream retains its internal storage reference on self-assignment.
gboolean
g_mime_stream_mem_get_owner (GMimeStreamMem *mem);
Gets whether or not mem
owns the backend memory buffer.
void g_mime_stream_mem_set_owner (GMimeStreamMem *mem,gboolean owner);
Sets whether or not mem
owns the backend memory buffer.
Note: owner
should be TRUE if the stream should free the backend
memory buffer when closed or destroyed or FALSE otherwise. Substreams
independently retain and release a reference to their shared array,
regardless of this setting; enabling ownership does not release it twice.