| Top |
| GMimeContent * | g_mime_content_new () |
| GMimeContent * | g_mime_content_new_with_stream () |
| void | g_mime_content_set_stream () |
| GMimeStream * | g_mime_content_get_stream () |
| void | g_mime_content_set_encoding () |
| GMimeContentEncoding | g_mime_content_get_encoding () |
| gboolean | g_mime_content_get_newline_format () |
| void | g_mime_content_set_newline_format () |
| void | g_mime_content_clear_newline_format () |
| GMimeStream * | g_mime_content_open () |
| ssize_t | g_mime_content_write_to_stream () |
| ssize_t | g_mime_content_decode_to_stream () |
A GMimeContent is a wrapper object for a GMimePart's body, allowing clients to read the content from the backing stream without having to know whether it is encoded/compressed/etc and not neding to know how to undo said encoding(s).
GMimeContent * g_mime_content_new_with_stream (GMimeStream *stream,GMimeContentEncoding encoding);
Creates a new GMimeContent object around stream
.
void g_mime_content_set_stream (GMimeContent *content,GMimeStream *stream);
Replaces the wrapper's internal stream with stream
. Don't forget,
if stream
is not of the same encoding as the old stream, you'll
want to call g_mime_content_set_encoding() as well.
Note: caller is responsible for its own reference on
stream
.
GMimeStream *
g_mime_content_get_stream (GMimeContent *content);
Gets a reference to the stream wrapped by content
.
void g_mime_content_set_encoding (GMimeContent *content,GMimeContentEncoding encoding);
Sets the encoding type of the internal stream.
GMimeContentEncoding
g_mime_content_get_encoding (GMimeContent *content);
Gets the encoding type of the stream wrapped by content
.
gboolean g_mime_content_get_newline_format (GMimeContent *content,GMimeNewLineFormat *format);
Gets the raw content's new-line format, if known. This is a hint for
verifying digital signatures, not a request to convert the content.
Mixed newlines are reported as GMIME_NEWLINE_FORMAT_MIXED. Content
without LF or CRLF has no known format.
void g_mime_content_set_newline_format (GMimeContent *content,GMimeNewLineFormat format);
Sets the raw content's new-line format hint without modifying its bytes.
void
g_mime_content_clear_newline_format (GMimeContent *content);
Clears the new-line format hint without modifying the content. Replacing the backing stream also clears this hint.
GMimeStream *
g_mime_content_open (GMimeContent *content);
Rewinds the backing stream and returns a new stream which decodes the content as it is read, without buffering the entire content in memory. Default, 7bit, 8bit, and binary content pass through unchanged.
The returned stream retains the backing stream but does not close it. It has its own decoder state, using the encoding at the time of this call. Readers share the backing stream's position, so opening another reader or otherwise using that stream can interfere with existing readers. Closing a reader does not rewind the backing stream.
a decoded stream, or NULL if
rewinding fails, with errno set by the backing stream. Read failures are
reported by g_mime_stream_read() as -1 with errno set.
ssize_t g_mime_content_write_to_stream (GMimeContent *content,GMimeStream *stream);
Copies the backing stream verbatim, without decoding its transfer encoding. Rewinds the source before copying and again on success. On an I/O failure, leaves the source at its current position. Neither stream is closed and the output stream is not flushed.
Use g_mime_content_decode_to_stream() for decoded bytes or
g_mime_content_open() for a decoded reader.
ssize_t g_mime_content_decode_to_stream (GMimeContent *content,GMimeStream *stream);
Decodes the content into stream
using the content's transfer encoding.
Default, 7bit, 8bit, and binary data pass through unchanged. Calls the
virtual g_mime_content_write_to_stream() through a decoder, rewinding the
source before copying and again on success. An I/O failure leaves the
source at its current position. Neither stream is closed or flushed;
only the decoder's buffered data is flushed.