DataWrapper
Object Hierarchy:
Description:
[
CCode ( type_id =
"camel_data_wrapper_get_type ()" ) ]
public class DataWrapper :
Object
Base class for structured MIME data access.
DataWrapper is the base class used to implement structured MIME data access. It serves as the programmatic
interface for creating and reading MIME-encoded data, primarily RFC 822 messages.
The class hierarchy rooted at DataWrapper closely parallels the structure of a MIME message:
- DataWrapper itself holds unstructured leaf data (e.g. an attachment body) together with its content-type
and transfer encoding.
- Medium extends it with named headers and a separate content object.
- MimePart adds structured accessors for all standard Content-* headers (Content-Type,
Content-Disposition, Content-Transfer-Encoding, etc.) and can be constructed from a
MimeParser.
- MimeMessage is a fully-fledged RFC 822 message with From/To/Subject and other
message-level headers, built on top of MimePart.
- Multipart and its subclasses (
MultipartSigned, MultipartEncrypted) handle multipart MIME containers.
The i/o interface is stream-based: write_to_stream serialises the
object into encoded MIME form, while decode_to_stream writes the
decoded content (stripping the content-transfer-encoding).
construct_from_stream is the main entry point for parsing raw MIME data into an object hierarchy.
Content:
Creation methods:
Methods:
- public size_t calculate_decoded_size_sync (Cancellable? cancellable = null) throws Error
Calculates decoded size of the this
by saving it to a null-stream and returns how many bytes had been written.
- public size_t calculate_size_sync (Cancellable? cancellable = null) throws Error
Calculates size of the this by
saving it to a null-stream and returns how many bytes had been written.
- public bool construct_from_data_sync (void* data, ssize_t data_len, Cancellable? cancellable = null) throws Error
Constructs the content of this from
data of length data_len.
- public async bool construct_from_input_stream (InputStream input_stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously constructs the content of
this from input_stream.
- public virtual bool construct_from_input_stream_sync (InputStream input_stream, Cancellable? cancellable = null) throws Error
Constructs the content of this from
input_stream.
- public async bool construct_from_stream (Stream stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously constructs the content of
this from the given stream.
- public virtual bool construct_from_stream_sync (Stream stream, Cancellable? cancellable = null) throws Error
Constructs the content of this from
the given stream.
- public async ssize_t decode_to_output_stream (OutputStream output_stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously writes the decoded data content to output_stream
.
- public virtual ssize_t decode_to_output_stream_sync (OutputStream output_stream, Cancellable? cancellable = null) throws Error
Writes the decoded data content to output_stream.
- public async ssize_t decode_to_stream (Stream stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously writes the decoded data content to stream.
- public virtual ssize_t decode_to_stream_sync (Stream stream, Cancellable? cancellable = null) throws Error
Writes the decoded data content to stream.
- public unowned ByteArray get_byte_array ()
Returns the
ByteArray being used to hold the contents of this.
- public TransferEncoding get_encoding ()
- public virtual string get_mime_type ()
- public virtual unowned ContentType? get_mime_type_field ()
- public virtual bool is_offline ()
- public void set_encoding (TransferEncoding encoding)
- public virtual void set_mime_type (string mime_type)
This sets the data wrapper's MIME type.
- public virtual void set_mime_type_field (ContentType? mime_type)
This sets the data wrapper's MIME type.
- public void set_offline (bool offline)
Sets whether the this is "offline".
- public void take_mime_type_field (owned ContentType? mime_type)
Sets mime-type filed to be mime_type and consumes it, aka
unlike set_mime_type_field, this doesn't add its own
reference to mime_type.
- public async ssize_t write_to_output_stream (OutputStream output_stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously writes the content of this
to output_stream in a machine-independent format appropriate for the data.
- public virtual ssize_t write_to_output_stream_sync (OutputStream output_stream, Cancellable? cancellable = null) throws Error
Writes the content of this to
output_stream in a machine-independent format appropriate for the data.
- public async ssize_t write_to_stream (Stream stream, int io_priority, Cancellable? cancellable = null) throws Error
Asynchronously writes the content of this
to stream in a machine-independent format appropriate for the data.
- public virtual ssize_t write_to_stream_sync (Stream stream, Cancellable? cancellable = null) throws Error
Writes the content of this to
stream in a machine-independent format appropriate for the data.
Inherited Members:
All known members inherited from class GLib.Object