net.rim.blackberry.api.mail
Interface Part

All Known Implementing Classes:
BodyPart, FileSupportedAttachmentPart, Message, MimeBodyPart, PDAPContactAttachmentPart, SupportedAttachmentPart, TextBodyPart, UnsupportedAttachmentPart

public interface Part

Defines the header fields and contents of a Message or a BodyPart, in a Multipart object.

A part consists of a set of header fields and a body (contents).

Each part has a standard set of header fields (also called attributes) that are common to most existing mail systems. The BlackBerry Mail API currently only supports the CONTENT_TYPE header type, which defines the MIME content type of the body's contents. Use Part.getContentType() to retrieve the content type, and Part.getContent() to retrieve the actual content.

Use Part.writeTo(java.io.OutputStream) to write out the part's content to a byte stream in a form suitable for mail transmission. This byte stream is typically an aggregation of the header fields and contents. For more information, see RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Field Summary
Category: Signed static String ATTACHMENT
          Present this part as an attachment.
Category: Signed static String INLINE
          Present this part inline.
 
Method Summary
Category: Signed  void addHeader(String header_name, String header_value)
          Adds a value to header field by name.
Category: Signed  Enumeration getAllHeaders()
          Retrieves all the header fields for this part.
Category: Signed  Object getContent()
          Retrieves this part's contents.
Category: Signed  String getContentType()
          Retrieves the content-type set for this part's contents.
Category: Signed  String[] getHeader(String header_name)
          Retrieves header fields by name.
Category: Signed  InputStream getInputStream()
          Retrieves an input stream for this part's contents.
Category: Signed  int getSize()
          Retrieves the size of this part's contents.
Category: Signed  boolean isMimeType(String mimeType)
          Determines if this part's contents are of the provided MIME content type.
Category: Signed  void removeHeader(String header_name)
          Removes all header fields by name.
Category: Signed  void setContent(Object ch)
          Sets this part's contents.
Category: Signed  void setHeader(String header_name, String header_value)
          Sets the value for header field by name.
Category: Signed  void writeTo(OutputStream os)
          Writes this part's contents to a provided output stream.
 



Field Detail

ATTACHMENT

static final String ATTACHMENT
Present this part as an attachment.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

INLINE

static final String INLINE
Present this part inline.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

addHeader

void addHeader(String header_name,
               String header_value)
Adds a value to header field by name.

Parameters:
header_name - Name of the header field to add.
header_value - Name of the value to set for the header field.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

removeHeader

void removeHeader(String header_name)
Removes all header fields by name.

Parameters:
header_name - Name of the header fields to remove.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setHeader

void setHeader(String header_name,
               String header_value)
Sets the value for header field by name.

Parameters:
header_name - Name of the header field for which to set a value.
header_value - Value to set for the header field.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getHeader

String[] getHeader(String header_name)
Retrieves header fields by name.

Parameters:
header_name - Name of the header field to get.
Returns:
List of one or more header fields matching provided name.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getAllHeaders

Enumeration getAllHeaders()
Retrieves all the header fields for this part.

Returns:
An enumeration of this part's header fields.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setContent

void setContent(Object ch)
                throws MessagingException
Sets this part's contents.

Parameters:
ch - Object to use for this part's contents.
Throws:
MessagingException - To indicate a general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getContent

Object getContent()
Retrieves this part's contents.

Returns:
Object containing this part's contents.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getContentType

String getContentType()
Retrieves the content-type set for this part's contents.

Returns:
MIME content type for this part's contents, if set; if not set, this method should return null.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

isMimeType

boolean isMimeType(String mimeType)
Determines if this part's contents are of the provided MIME content type.

Parameters:
mimeType - Name of the MIME type to match against this part's contents.
Returns:
True if this part's content-type matches your provided name; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getInputStream

InputStream getInputStream()
Retrieves an input stream for this part's contents.

Returns:
Input stream of bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

writeTo

void writeTo(OutputStream os)
             throws IOException
Writes this part's contents to a provided output stream.

Use this method to write out a byte stream of this part's contents, in a form suitable for mail transmission. The byte stream is typically an aggregation of the headers and body.

Parameters:
os - Output stream of bytes to write to.
Throws:
IOException - To signal that an I/O exception has occurred.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getSize

int getSize()
Retrieves the size of this part's contents.

Returns:
Size of this part's contents in bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal