All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.network.mail.base.MimeBodyPart

java.lang.Object
   |
   +----com.ibm.network.mail.base.MimeBodyPart

public class MimeBodyPart
extends Object
implements Encodable, Decodable, MimePart, MimeStreamWriter
This class represents a MIME body part. It implements the MimePart interface. It also implements Encodable, Decodable and MimeStreamWriter interfaces. MimeBodyParts are contained in a MimeMultipart object.

MimeBodyPart uses the Header class to store the header fields.

Author:
Abdul Majeed Ghadialy, Mohit M. Sant
See Also:
MimeMultipart, MimeStreamWriter, Encodable, Decodable

Variable Index

 o header

Constructor Index

 o MimeBodyPart()
Constructor for MimeBodyPart.
 o MimeBodyPart(InputStream)
Constructor for MimeBodyPart.

Method Index

 o addHeader(String, String)
Adds a new field to the Header of this body part.
 o decode(MimeMap)
Decodes the content of this body part using the specified MimeMap.
 o encode(MimeMap)
Encodes the content of this body part using the specified MimeMap.
 o getContent()
Returns the content of this body part.
 o getContentType()
Returns the MIME data type of this body part.
 o getDisposition()
Returns the disposition of this part.
 o getEncoding()
Returns the Content-Transfer-Encoding of this body part.
 o getFileName()
Returns the file name of this body part, if any.
 o getHeader(String)
Returns the header field value for the specified header field key.
 o getInputStream()
Returns an InputStream connected to the content of this body part.
 o putByteStream(OutputStream)
Writes the header and encoded data to the OutputStream.
 o setContent(Object, String)
Sets the content of this body part to specified content and the MIME data type to specified type.
 o setDisposition(int)
Sets the content disposition of this body part to specified disposition.
 o setEncoding(int)
Sets the content transfer encoding of this body part to specified encoding.
 o setFileName(String)
Sets the file name of this body part to specified file name.
 o setHeader(String, String)
Adds a new field to the specified Header of this body part.
 o setHeaderFields(Header)
Sets the header fields of this body part to the values specified by Header.

Variables

 o header
 public Header header

Constructors

 o MimeBodyPart
 public MimeBodyPart()
Constructor for MimeBodyPart. Creates a new MIME body part without any content.

 o MimeBodyPart
 public MimeBodyPart(InputStream in) throws IOException
Constructor for MimeBodyPart. Creates a new MIME body part and initializes the content from the specified input stream.

Parameters:
in - InputStream from where to initialize content.

Methods

 o addHeader
 public void addHeader(String name,
                       String value)
Adds a new field to the Header of this body part.

Parameters:
name - header field key
value - header field value
See Also:
addField
 o decode
 public void decode(MimeMap map)
Decodes the content of this body part using the specified MimeMap. MIME decoder specified by MimeMap is used for decoding.

Parameters:
map - the MIME type - decoder map.
See Also:
getDecoder, MimeEncoder, MimeDecoder, decode
 o encode
 public void encode(MimeMap map)
Encodes the content of this body part using the specified MimeMap. MIME encoder specified by MimeMap is used for encoding.

Parameters:
map - the MIME type - encoder map.
See Also:
getEncoder, encode, MimeEncoder
 o getContent
 public Object getContent()
Returns the content of this body part.

Returns:
the content of this body part.
 o getContentType
 public String getContentType()
Returns the MIME data type of this body part.

Returns:
the MIME data type of this body part.
 o getDisposition
 public int getDisposition()
Returns the disposition of this part. The disposition describes how the part should be presented to the user.

Returns:
the Content-Disposition of this part.
 o getEncoding
 public int getEncoding()
Returns the Content-Transfer-Encoding of this body part.

Returns:
the Content-Transfer-Encoding of this body part.
 o getFileName
 public String getFileName()
Returns the file name of this body part, if any.

Returns:
the file name of this body part, if any
 o getHeader
 public String getHeader(String name)
Returns the header field value for the specified header field key.

Parameters:
name - header field key
Returns:
header field value
 o getInputStream
 public InputStream getInputStream()
Returns an InputStream connected to the content of this body part.

Returns:
InputStream connected to the content of this body part.
 o putByteStream
 public void putByteStream(OutputStream os) throws IOException
Writes the header and encoded data to the OutputStream.

Parameters:
os - OutputStream to write header and content of this body part.
Throws: IOException
in case an IO error is encountered.
See Also:
putByteStream
 o setContent
 public void setContent(Object content,
                        String type)
Sets the content of this body part to specified content and the MIME data type to specified type. content should be an instance of one of the following: InputStream (content should not be MIME encoded) , String (content should not be MIME encoded) , BufferedReader (content should be MIME encoded).

Parameters:
content - content to be set this body part.
type - MIME data type.
 o setDisposition
 public void setDisposition(int disp)
Sets the content disposition of this body part to specified disposition.

Parameters:
disp - Content-Disposition.
 o setEncoding
 public void setEncoding(int encoding)
Sets the content transfer encoding of this body part to specified encoding.

Parameters:
encoding - Content-Transfer encoding.
 o setFileName
 public void setFileName(String fileName)
Sets the file name of this body part to specified file name.

Parameters:
fileName - name of the file.
 o setHeader
 public void setHeader(String name,
                       String value)
Adds a new field to the specified Header of this body part.

Parameters:
name - header field key.
value - header field value.
See Also:
addField
 o setHeaderFields
 public void setHeaderFields(Header hdr)
Sets the header fields of this body part to the values specified by Header.

Parameters:
hdr - Header to read fields from and set the header fields of this body part.

All Packages  Class Hierarchy  This Package  Previous  Next  Index