com.hunnysoft.jmime
Class Message

java.lang.Object
  extended by com.hunnysoft.jmime.Node
      extended by com.hunnysoft.jmime.Entity
          extended by com.hunnysoft.jmime.Message
All Implemented Interfaces:
java.lang.Cloneable

public class Message
extends Entity

Class that represents an RFC 2822 or MIME message.

A message contains both a collection of header fields and a body. In the terminology of RFC 2045, the general term for the headers-body combination is entity. In Hunny JMIME, Message is a direct subclass of Entity, and therefore contains both a Headers object and a Body object.

In the document tree representation of message, a Message object is almost always a root node, having child nodes but no parent node. The child nodes are the Headers object and the Body object it contains. A Message may sometimes be an intermediate node. In this special case, the parent node is a Body object of type "message/rfc822" and the Message object represents an encapsulated message.

To access the contained Headers object, use the inherited method Entity.headers(). To access the contained Body object, use the inherited method Entity.body().


Field Summary
 
Fields inherited from class com.hunnysoft.jmime.Node
mIsModified, mParent, mString
 
Constructor Summary
Message()
          Default constructor.
Message(ByteString bstr)
          Constructor that takes an initial byte string argument.
Message(Message other)
          Copy constructor.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this object.
 
Methods inherited from class com.hunnysoft.jmime.Entity
_parse, assemble, body, headers, parse, setBody, setHeaders
 
Methods inherited from class com.hunnysoft.jmime.Node
_setString, isModified, parent, setModified, setParent, setString, string, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Message

public Message()
Default constructor.

This constructor sets the Message object's string representation to the empty string and sets its parent object to null.


Message

public Message(Message other)
Copy constructor.

This constructor performs a deep copy of its argument. The parent node of the new Message object is set to null.

Parameters:
other - Message instance to copy

Message

public Message(ByteString bstr)
Constructor that takes an initial byte string argument.

This constructor sets the Message object's string representation to bstr and sets its parent node to null.

Normally, you call the parse() method immediately after this constructor to create the broken-down representation.

Parameters:
bstr - initial value for the string representation
Method Detail

clone

public java.lang.Object clone()
Creates a copy of this object.

This method, inherited from Object, creates a new Message object that has the same value as this Message object. The parent node of the new Message object is set to null.

Overrides:
clone in class Node
Returns:
a copy of this object