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
-
header
-
-
MimeBodyPart()
- Constructor for
MimeBodyPart
.
-
MimeBodyPart(InputStream)
- Constructor for
MimeBodyPart
.
-
addHeader(String, String)
- Adds a new field to the
Header
of this body part.
-
decode(MimeMap)
- Decodes the content of this body part using the specified
MimeMap
.
-
encode(MimeMap)
- Encodes the content of this body part using the specified
MimeMap
.
-
getContent()
- Returns the content of this body part.
-
getContentType()
- Returns the MIME data type of this body part.
-
getDisposition()
- Returns the disposition of this part.
-
getEncoding()
- Returns the Content-Transfer-Encoding of this body part.
-
getFileName()
- Returns the file name of this body part, if any.
-
getHeader(String)
- Returns the header field value for the specified header field key.
-
getInputStream()
- Returns an
InputStream
connected to the content of this
body part.
-
putByteStream(OutputStream)
- Writes the header and encoded data to the
OutputStream
.
-
setContent(Object, String)
- Sets the content of this body part to specified content and the MIME data
type to specified type.
-
setDisposition(int)
- Sets the content disposition of this body part to specified disposition.
-
setEncoding(int)
- Sets the content transfer encoding of this body part to specified encoding.
-
setFileName(String)
- Sets the file name of this body part to specified file name.
-
setHeader(String, String)
- Adds a new field to the specified
Header
of this body part.
-
setHeaderFields(Header)
- Sets the header fields of this body part to the values specified by
Header
.
header
public Header header
MimeBodyPart
public MimeBodyPart()
- Constructor for
MimeBodyPart
.
Creates a new MIME body part without any content.
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.
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
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
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
getContent
public Object getContent()
- Returns the content of this body part.
- Returns:
- the content of this body part.
getContentType
public String getContentType()
- Returns the MIME data type of this body part.
- Returns:
- the MIME data type of this body part.
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.
getEncoding
public int getEncoding()
- Returns the Content-Transfer-Encoding of this body part.
- Returns:
- the Content-Transfer-Encoding of this body part.
getFileName
public String getFileName()
- Returns the file name of this body part, if any.
- Returns:
- the file name of this body part, if any
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
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.
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
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.
setDisposition
public void setDisposition(int disp)
- Sets the content disposition of this body part to specified disposition.
- Parameters:
- disp - Content-Disposition.
setEncoding
public void setEncoding(int encoding)
- Sets the content transfer encoding of this body part to specified encoding.
- Parameters:
- encoding - Content-Transfer encoding.
setFileName
public void setFileName(String fileName)
- Sets the file name of this body part to specified file name.
- Parameters:
- fileName - name of the file.
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
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