com.funambol.mail
Class BodyPart

java.lang.Object
  extended by com.funambol.mail.Part
      extended by com.funambol.mail.BodyPart

public class BodyPart
extends Part

A BodyPart object is foreseen to be inserted into a Multipart container, itself inserted in a multi-part Message with MIME Content-Type equal to "multipart"


Field Summary
static java.lang.String CD_ATTACHMENT
          A possible value for the the "Content-Disposition" header field
static java.lang.String CD_INLINE
          A possible value for the the "Content-Disposition" header field
static java.lang.String CONTENT_DISPOSITION
          The name of the MIME Content-Disposition header attribute
 
Fields inherited from class com.funambol.mail.Part
CONTENT_TRANSFER_ENCODING, CONTENT_TYPE, contentType, ENC_7BIT, ENC_8BIT, ENC_B64, ENC_QP, headers, MULTIPART, MULTIPART_ALTERNATIVE, MULTIPART_MIXED, size, TEXT_PLAIN
 
Constructor Summary
BodyPart()
           
BodyPart(Multipart container)
           
 
Method Summary
 void deserialize(java.io.DataInputStream din)
           
 java.lang.String getAttachUrl()
          Returns the value of the attachment url This represents the attachment file url for this BodyPart
 Multipart getContainer()
          Returns the container Multipart of this BodyPart.
 java.lang.Object getContent()
          Returns the content of of this BodyPart.
 java.lang.String getDisposition()
          Returns the value of the "Content-Disposition" header field.
 java.lang.String getFileName()
          Returns the value of the filename attribute of the "Content-Disposition" header field.
 java.lang.String getTextContent()
           
 void serialize(java.io.DataOutputStream dout)
           
 void setAttachUrl(java.lang.String au)
          Sets the attachment file url of this BodyPart
 void setContainer(Multipart container)
          Sets the container Multipart of this BodyPart.
 void setContent(java.lang.Object content)
          Sets the content of this BodyPart.
 void setContent(java.lang.Object content, java.lang.String type)
          Sets the content of this BodyPart.
 void setDisposition(java.lang.String disp)
          Set the content disposition of this BodyPart
 void setFileName(java.lang.String fn)
          Sets the file name of this BodyPart
 
Methods inherited from class com.funambol.mail.Part
addHeader, getAllHeaders, getContentType, getHeader, getSize, isMultipart, isText, isTextHtml, isTextPlain, removeHeader, setContentType, setHeader, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_DISPOSITION

public static final java.lang.String CONTENT_DISPOSITION
The name of the MIME Content-Disposition header attribute

See Also:
Constant Field Values

CD_ATTACHMENT

public static final java.lang.String CD_ATTACHMENT
A possible value for the the "Content-Disposition" header field

See Also:
Constant Field Values

CD_INLINE

public static final java.lang.String CD_INLINE
A possible value for the the "Content-Disposition" header field

See Also:
Constant Field Values
Constructor Detail

BodyPart

public BodyPart()

BodyPart

public BodyPart(Multipart container)
Method Detail

getDisposition

public java.lang.String getDisposition()
Returns the value of the "Content-Disposition" header field. This represents the disposition of this BodyPart. The disposition describes how the part should be presented to the user.

Returns:
The value of the Content-Disposition header field of this part or null if not present.

getFileName

public java.lang.String getFileName()
Returns the value of the filename attribute of the "Content-Disposition" header field. This represents the filename for this BodyPart (suggests to the receiving mail client how to name it).

Returns:
The value of the filename of this BodyPart, or null if not present.

getAttachUrl

public java.lang.String getAttachUrl()
Returns the value of the attachment url This represents the attachment file url for this BodyPart

Returns:
The value of the attachment url of this BodyPart, or null if not present.

getContainer

public Multipart getContainer()
Returns the container Multipart of this BodyPart.

Returns:
A reference to the Multipart object this part is contained in, if the message is a multi-part message

getContent

public java.lang.Object getContent()
Returns the content of of this BodyPart.

Specified by:
getContent in class Part
Returns:
A reference to the Object in this BodyPart, or null if empty.

getTextContent

public java.lang.String getTextContent()
Returns:
The textual content of this BodyPart, if it is a String, or null otherwise.

setContainer

public void setContainer(Multipart container)
Sets the container Multipart of this BodyPart.

Parameters:
container - A reference to the Multipart object to set as container

setContent

public void setContent(java.lang.Object content)
                throws MailException
Sets the content of this BodyPart. It can be a Multipart or text (a String) or a byte array (e.g. a jpeg attachment).

Specified by:
setContent in class Part
Throws:
MailException

setContent

public void setContent(java.lang.Object content,
                       java.lang.String type)
                throws MailException
Sets the content of this BodyPart. This can be another Multipart (for instance, a multipart/mixed message can contains a multipart/alternative in one bodypart), String (in case of a text content) or a byte array for binary data.

Specified by:
setContent in class Part
Parameters:
content - The content object
type - The MIME type of the content
Throws:
MailException

setDisposition

public void setDisposition(java.lang.String disp)
Set the content disposition of this BodyPart

Parameters:
disp - One of ATTACHMENT or INLINE

setFileName

public void setFileName(java.lang.String fn)
Sets the file name of this BodyPart

Parameters:
fn - The file name of the attachment

setAttachUrl

public void setAttachUrl(java.lang.String au)
Sets the attachment file url of this BodyPart

Parameters:
au - The url of the attachment

serialize

public void serialize(java.io.DataOutputStream dout)
               throws java.io.IOException
Throws:
java.io.IOException

deserialize

public void deserialize(java.io.DataInputStream din)
                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2001-2009 Funambol.