The Message =========== Messages transport data from one target to another target. Messages can also be sent from outside a target - if you have access to the kernel class. Messages consist of an envelope (**Envelope**) and one or more **Records**. The class of the message is the ``CMessage`` class. It has various constructors:: // Creation from a stream static CMessage createFromStream(final DataInputStream aStream) throws IOException; // with envelope, but without record CMessage(); // with envelope, but without record CMessage(final CEnvelope aEnvelope); // with envelope and record CMessage(final CRecord aRecord) // with envelope and record CMessage(final CEnvelope aEnvelope, final CRecord aRecord); // from a template CMessage(final CMessage aTemplate); Accessing Records ***************** The records are accessed using the following methods:: // adds a record void addRecord(final CRecord aRecord); // get the first record CRecord getFirstRecord(); // The iterator for records Iterator iterator(); // How many records? int size(); Most messages have only one record. Only if many messages are sent to other NODES, it makes sense to assign several records to an envelope, as this can reduce the header overhead. By the way, messages are separated into envelope and records when they are delivered to the message handler of a target. Only one record + envelope is passed to the message handler. If the message has more than one record, the corresponding message handler is called more than once. Accessing Envelopes ******************* The envelope can only be fetched; you can only set it using the constructor:: CEnvelope getEnvelope(); Stream ****** To pack a message in a stream, you can use the following method:: void toStream(final DataOutputStream aStream) throws IOException; .. _ENVELOPES: .. _SLOTS: