| Top |
| GMimeStream * | g_mime_stream_block_new () |
| int | g_mime_stream_block_set_length () |
| GByteArray * | g_mime_stream_block_to_byte_array () |
Ports MimeKit's MemoryBlockStream using 2048-byte blocks. Growing the
stream does not copy previously stored bytes. Seeking cannot extend the
stream; use g_mime_stream_block_set_length() to grow it before seeking.
New blocks are zero-initialized rather than rented from a managed pool.
Native bounds and substreams use absolute coordinates, including SEEK_SET. Substreams share storage and length but have independent positions and bounds. Closing one view does not close another. Reset rewinds without discarding content. Nonempty I/O, position, length, reset and flush fail with EBADF after close; native zero-length I/O remains a no-op.
The backing length is limited to G_MAXINT * 2048 bytes. As in MimeKit, writes ending at that limit are rejected, although setting length accepts it. Allocation follows GLib's normal allocation policy. The optional contiguous copy is limited to G_MAXUINT bytes.
GMimeStream *
g_mime_stream_block_new (void);
Creates an empty memory stream backed by 2048-byte blocks.
int g_mime_stream_block_set_length (GMimeStreamBlock *stream,gint64 length);
Resizes the shared backing store to the start bound plus length
.
Growing exposes zero-initialized bytes. Shrinking releases unneeded blocks
and clears the truncated tail before it can be exposed again. The caller's
position is clamped to the new end; other views retain their positions.
A finite end bound is updated to the new end.
GByteArray * g_mime_stream_block_to_byte_array (GMimeStreamBlock *stream,GError **error);
Copies the bytes within the stream's bounds into an independent contiguous array without changing position. The caller owns the returned copy.