net.rim.blackberry.api.mail
Class BodyPart
java.lang.Object
net.rim.blackberry.api.mail.BodyPart
- All Implemented Interfaces:
- Part
- Direct Known Subclasses:
- MimeBodyPart, PDAPContactAttachmentPart, SupportedAttachmentPart, TextBodyPart, UnsupportedAttachmentPart
public abstract class BodyPart
- extends Object
- implements Part
Represents a part contained in a Multipart
.
A body part object comprises header attributes and body
contents. This is an abstract class; subclasses provide actual
implementations.
The BlackBerry Mail API provides three classes that implement different
types of body parts: TextBodyPart
, SupportedAttachmentPart
,
and UnsupportedAttachmentPart
.
- See Also:
Multipart
- 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
Nested Class Summary |
|
static interface |
BodyPart.ContentType
The following constants define some common attachment types and subtypes. |
Field Summary |
|
static String |
CONTENT_TYPE
MIME content-type header type. |
|
protected static byte[] |
CRLF
Line feed character. |
|
protected static byte[] |
EMPTY
Empty character. |
|
protected static char |
SEPARATOR
Separator (:) character. |
Constructor Summary |
|
protected |
BodyPart(Multipart parent)
Constructs a new BodyPart instance. |
CONTENT_TYPE
public static String CONTENT_TYPE
- MIME content-type header type.
- 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
SEPARATOR
protected static final char SEPARATOR
- Separator (:) character.
- 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
CRLF
protected static final byte[] CRLF
- Line feed character.
- 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
EMPTY
protected static final byte[] EMPTY
- Empty character.
- 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
BodyPart
protected BodyPart(Multipart parent)
- Constructs a new BodyPart instance.
- Parameters:
parent
- The multi-part object to contain this body part.- 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
getParent
public Multipart getParent()
- Retrieves the multi-part object containing this body part.
- Returns:
- This body part's containing multi-part.
- 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
addHeader
public void addHeader(String name,
String value)
- Adds a header for this body part.
Note that currently only the BodyPart.CONTENT_TYPE
header is
supported; sub-classes should implement support for an expanded variety
of headers if they require it. Invoking this method more than once will
therefore overwrite the content-type value previously associated with
this body part.
- Specified by:
addHeader
in interface Part
- Parameters:
name
- Name for his header; currently, only BodyPart.CONTENT_TYPE
is supported.value
- Value associated with this header (i.e. content type for
this body part).- 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
public Enumeration getAllHeaders()
- Retrieves all headers associated with this body part as an Enumeration of String objects.
- Specified by:
getAllHeaders
in interface Part
- Returns:
- Enumeration containing all the headers added to this body part.
- 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
public String getContentType()
- Retrieves this body part's content type.
- Specified by:
getContentType
in interface Part
- Returns:
- The MIME type for this body part.
- 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
setContentType
public void setContentType(String value)
- Sets this body part's content type.
Note: This method is currently unsupported.
- Parameters:
value
- MIME content type for this body part.- 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
public String[] getHeader(String header)
- Retrieves all headers of a specific name.
- Specified by:
getHeader
in interface Part
- Parameters:
header
- Name of the headers to retrieve (currently only
BodyPart.CONTENT_TYPE
headers are supported; see BodyPart.addHeader(java.lang.String, java.lang.String)
).
- Returns:
- List of values for the specified header type, or an empty array
if no header values yet set for this body part.
- 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
public boolean isMimeType(String mimeType)
- Determines if this body part is of the specified MIME content type.
- Specified by:
isMimeType
in interface Part
- Parameters:
mimeType
- MIME content type to match against this body type.
- Returns:
- True if this body part is of the specified MIME type; 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
removeHeader
public void removeHeader(String header)
- Removes a header from this body part.
- Specified by:
removeHeader
in interface Part
- Parameters:
header
- Header type to remove; all header values of this type get
removed. Currently, this method supports only the BodyPart.CONTENT_TYPE
header type.- 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
public void setHeader(String header,
String value)
- Sets a header for this body part, by type.
- Specified by:
setHeader
in interface Part
- Parameters:
header
- Header type to set; currently, this method supports only
the BodyPart.CONTENT_TYPE
header type.value
- Value to set for the specified header type.- 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
public void writeTo(OutputStream os)
throws IOException
- Writes information about this body part's content type to provided output
stream.
- Specified by:
writeTo
in interface Part
- Parameters:
os
- Output stream to which to write the retrieved information.
- Throws:
IOException
- Signals that an I/O error 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
hasMore
public boolean hasMore()
- Determines if more data for this body part is available on the server.
- Returns:
- True if more data is available; 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
moreRequestSent
public boolean moreRequestSent()
- Determines if a request has been sent for more data for this body part.
- Returns:
- True if more data has been requested for this body part;
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
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