com.hunnysoft.jmime
Class BodyPart

java.lang.Object
  extended bycom.hunnysoft.jmime.Node
      extended bycom.hunnysoft.jmime.Entity
          extended bycom.hunnysoft.jmime.BodyPart
All Implemented Interfaces:
java.lang.Cloneable

public class BodyPart
extends Entity

Class that represents a MIME body part.

BodyPart represents a body part, as described in RFC 2045 and RFC 2046. A body part is an entity, so it has a collection of header fields and a body. A body part is different from a message in that a body part is part of a multipart body.

In Hunny JMIME, a BodyPart is a subclass of Entity; therefore, it contains both a Headers object and a Body object, and it is contained in a multipart Body object.

In the document tree representation of message, a BodyPart object is always an intermediate node, having a parent node and child nodes. The parent node is the Body object that contains it. The child nodes are the Headers object and the Body object it contains. (See the documentation for Node for a discussion of the tree representation of a message.)

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


Field Summary
 
Fields inherited from class com.hunnysoft.jmime.Node
mIsModified, mParent, mString
 
Constructor Summary
BodyPart()
          Default constructor.
BodyPart(BodyPart other)
          Copy constructor.
BodyPart(ByteString bstr)
          Constructor that takes an initial byte string argument.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this object.
 
Methods inherited from class com.hunnysoft.jmime.Entity
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

BodyPart

public BodyPart()
Default constructor.

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


BodyPart

public BodyPart(BodyPart other)
Copy constructor.

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

Parameters:
other - BodyPart instance to copy

BodyPart

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

This constructor sets the BodyPart 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 BodyPart object that has the same value as this BodyPart object. The parent node of the new BodyPart object is set to null.

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