|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.wireless.messaging.MessagePart
Instances of the MessagePart class can be added to a MultipartMessage. Each MessagePart consists of the content element, MIME type and content-id. The Content can be of any type. Additionally it’s possible to specify the content location and the encoding scheme.
| Constructor Summary | ||
MessagePart(byte[] contents,
int offset,
int length,
String mimeType,
String contentId,
String contentLocation,
String enc)
Constructs a MessagePart object from a subset of the byte array. |
||
MessagePart(byte[] contents,
String mimeType,
String contentId,
String contentLocation,
String enc)
Constructs a MessagePart object from a byte array. |
||
MessagePart(InputStream is,
String mimeType,
String contentId,
String contentLocation,
String enc)
Constructs a MessagePart object from an InputStream. |
||
| Method Summary | ||
byte[] |
getContent()
Returns the content of the MessagePart as an array of bytes. |
|
InputStream |
getContentAsStream()
Returns an InputStream for reading the contents of the MessagePart. |
|
String |
getContentID()
Returns the content-id value of the MessagePart |
|
String |
getContentLocation()
Returns content location of the MessagePart |
|
String |
getEncoding()
Returns the encoding of the content, e.g. |
|
int |
getLength()
Returns the content size of this MessagePart |
|
String |
getMIMEType()
Returns the mime type of the MessagePart |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MessagePart(byte[] contents,
int offset,
int length,
String mimeType,
String contentId,
String contentLocation,
String enc)
throws SizeExceededException
contents - byte array containing the contents for the MessagePartoffset - start positionlength - the number of bytes to be included in the MessagePartmimeType - the MIME Content-Type for the MessagePart [RFC 2046]contentId - the content-id header field value for the MessagePart [RFC 2045]. The content-id is
unique over all MessageParts of a MultipartMessage and must always be set for each message partcontentLocation - the content location which specifies the file name of the file that is attached. If
the content location is set to null no content location will be set for this MessagePart.enc - the encoding scheme for the MessagePart. If enc is set to null no encoding will be used for this MessagePart.IllegalArgumentException - - if mimeType or contentId is null. This
exception will be thrown if contentID or contentLocation contains other characters than
specified in US-ASCII format This exception will be thrown if either length is less than 0 or
offset + length exceeds the length of the content or if offset is less than 0 or if the
specified encoding scheme is unknown.SizeExceededException - - if the contents is larger than the available memory or supported size for the message part.
public MessagePart(byte[] contents,
String mimeType,
String contentId,
String contentLocation,
String enc)
throws SizeExceededException
contents - byte array containing the contents for the MessagePart. The contents of the array will be copied into the MessagePart.mimeType - the MIME Content-Type for the MessagePart [RFC 2046]contentId - the content-id header field value for the MessagePart [RFC 2045]. The content-id is unique over all MessageParts of a
MultipartMessage and must always be set for each message partcontentLocation - the content location which specifies the file name of the file that is attached. If the content location is set to null no content location will be set for this MessagePart.enc - the encoding scheme for the MessagePart. If enc is set to null no encoding will be used for this MessagePart.IllegalArgumentException - - if mimeType or contentId is null. This exception will be thrown if
contentID or contentLocation contains other characters than specified in US-ASCII format or if the specified encoding scheme is unknownSizeExceededException - - if the contents is larger than the available memory or supported size for the message part.public MessagePart(InputStream is, String mimeType, String contentId, String contentLocation, String enc) throws IOException, SizeExceededException
is - InputStream from which the contents of the MessagePart are readmimeType - the MIME Content-Type for the MessagePart [RFC 2046]contentId - the content-id header field value for the MessagePart [RFC 2045]. The content-id is unique over all MessageParts of a MultipartMessage and must always be set for each message partcontentLocation - the content location which specifies the file name of the file that is attached. If the content location is set to null no content location will be set for this MessagePart.enc - the encoding scheme for the MessagePart. If enc is set to null no encoding will be used for this MessagePart.IOException - - if the reading of the InputStream causes an exception other than EOFExceptionIllegalArgumentException - - if mimeType or contentId is null. This exception will be thrown if contentID or contentLocation contains other characters than
specified in US-ASCII format or if the specified encoding scheme is unknown.SizeExceededException - - if the content from the InputStream is larger than the available memory or supported size for the message part.| Method Detail |
public byte[] getContent()
public InputStream getContentAsStream()
public String getContentID()
public String getContentLocation()
public String getEncoding()
public int getLength()
public String getMIMEType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.