| java.lang.Object com.sun.tck.wma.sms.MessageObject com.sun.tck.wma.mms.MultipartObject
Constructor Summary | |
public | MultipartObject(String toAddress) Construct a multipart message and initialize the
target address. |
Method Summary | |
public boolean | addAddress(java.lang.String type, java.lang.String address) Adds an address to the multipart message.
Parameters: type - the address type ("to", "cc" or "bcc") as a String . | public void | addMessagePart(MessagePart part) Attaches a MessagePart to the multipart message.
Parameters: part - MessagePart to add exception: java.lang.IllegalArgumentException - if the Content-ID of theMessagePart conflicts with a Content-ID of aMessagePart already contained in this MultiPartMessage . | void | checkApplicationID(String newAppID) Checks an application ID to see if it can be legally added to this
message. | static void | checkHeaderValue(int headerIndex, String value) Checks the header field value. | MMSAddress | checkValidAddress(String addr) Checks if the string is a valid MMS address according to the grammar
in Appendix D of the spec. | public static MultipartObject | createFromByteArray(byte[] data) Create a message object from a serialized byte array. | static MessagePart | createMessagePart(DataInputStream dis) | public void | fixupReceivedMessageAddresses(String senderAddress, String myAddress) Prepares a received message to be sent right back to the sender.
Removes this device's address from the "to" and "cc"
address lists and sets the sender's address as the first "to" address.
Parameters: senderAddress - the sender's address. | public java.lang.String | getAddress() Returns the "from" address associated with this message, e.g. | Vector | getAddressList(String type) Gets the requested address list. | public java.lang.String[] | getAddresses(java.lang.String type) Gets the addresses of the multipart message of the specified type (e.g.
"to", "cc", "bcc" or "from") as String . | public String | getApplicationID() Returns the destination application identifier. | public byte[] | getAsByteArray() Gets the message object as a byte array. | public byte[] | getBodyAsByteArray() Gets the message object body as a byte array. | static String | getDevicePortionOfAddress(String address) Returns only the device part of the MMS Address. | public java.lang.String | getHeader(java.lang.String headerField) Gets the content of the specific header field of the multipart message. | public byte[] | getHeaderAsByteArray() Gets the message object header as a byte array. | static int | getHeaderFieldIndex(String headerField) Gets the location of the requested header from the
list of allowed header fields. | public MessagePart | getMessagePart(java.lang.String contentID) This method returns a MessagePart from the message that
matches the content-id passed as a parameter. | public MessagePart[] | getMessageParts() Returns an array of all MessagePart s of this message. | String | getReplyToApplicationID() Gets the "reply-to" application identifier. | public java.lang.String | getStartContentId() Returns the contentId of the start MessagePart . | public java.lang.String | getSubject() Gets the subject of the multipart message. | boolean | isAllowedToAccessHeaderField(String field) Checks if allowed to access the requested header field. | static boolean | isKnownHeaderField(String headerField) Checks if header field is known. | static void | readVector(DataInputStream dis, Vector v, boolean isAddress) Reads a vector from an input stream. | public boolean | removeAddress(java.lang.String type, java.lang.String address) Removes an address from the multipart message. | public void | removeAddresses() Removes all addresses of types "to", "cc", "bcc" from the
multipart message. | public void | removeAddresses(java.lang.String type) Removes all addresses of the specified type from the multipart message. | public boolean | removeMessagePart(MessagePart part) Removes a MessagePart from the multipart message. | public boolean | removeMessagePartId(java.lang.String contentID) Removes a MessagePart with the specific
contentID from the multipart message.
Parameters: contentID - identifies which MessagePart must bedeleted. | public boolean | removeMessagePartLocation(java.lang.String contentLocation) Removes MessagePart s with the specific content location
from the multipart message. | public void | setAddress(java.lang.String address) Sets the "to" address associated with this message. | public void | setFromAddress(String fromAddress) Sets the "from" address. | public void | setHeader(java.lang.String headerField, java.lang.String headerValue) Sets the specified header of the multipart message. | public void | setReplyToApplicationID(String appID) Sets the "reply-to" application identifier.
Parameters: appID - the return address application identifier. | public void | setStartContentId(java.lang.String contentId) Sets the Content-ID of the start MessagePart of
a multipart related message. | public void | setSubject(java.lang.String subject) Sets the Subject of the multipart message. | void | setupHeaderFields() Sets default values for all allowed header fields. | static void | writeMessagePart(DataOutputStream dos, MessagePart p) | static void | writeVector(DataOutputStream dos, Vector v, boolean isAddress) Writes a vector to an output stream. |
ALLOWED_HEADER_FIELDS | final static String[] ALLOWED_HEADER_FIELDS(Code) | | Array of allowed MMS header fields.
|
DEFAULT_HEADER_VALUES | final static String[] DEFAULT_HEADER_VALUES(Code) | | Array of default header values.
|
KNOWN_HEADER_FIELDS | final static String[] KNOWN_HEADER_FIELDS(Code) | | Array of known header fields.
|
MAX_TOTAL_SIZE | final static int MAX_TOTAL_SIZE(Code) | | Maximum size of MMS message.
Default value is 30730 (30K)
|
STREAM_SIGNATURE | final static String STREAM_SIGNATURE(Code) | | The content type for the MMS message.
|
applicationID | String applicationID(Code) | | The Application Identifier of the agent to process the message.
|
headerValues | String[] headerValues(Code) | | The array of message headers.
|
replyToApplicationID | String replyToApplicationID(Code) | | The Application Identifier of the return agent to
process the message.
|
startContentID | String startContentID(Code) | | The Content-ID of the part that starts the message.
|
subject | String subject(Code) | | The Subject field of the message.
|
MultipartObject | public MultipartObject(String toAddress)(Code) | | Construct a multipart message and initialize the
target address.
Parameters: toAddress - the address of the recipient. May be null. |
checkApplicationID | void checkApplicationID(String newAppID) throws IllegalArgumentException(Code) | | Checks an application ID to see if it can be legally added to this
message. The spec requires that only a single applicationID can be
specified for any MultipartMessage .
Parameters: newAppID - the candidate applicationID to check. May be null throws: IllegalArgumentException - if newAppID conflicts with anapplicationID already specified for this message. |
checkHeaderValue | static void checkHeaderValue(int headerIndex, String value)(Code) | | Checks the header field value.
Parameters: headerIndex - the index of the header field to check Parameters: value - the value to be checked exception: Error - if an invalid header index is requested exception: IllegalArgumentException - if the value is nota valid delivery time or priority |
checkValidAddress | MMSAddress checkValidAddress(String addr) throws IllegalArgumentException(Code) | | Checks if the string is a valid MMS address according to the grammar
in Appendix D of the spec.
Parameters: addr - the address to check MMSAddress representing the valid address, otherwise null. |
createFromByteArray | public static MultipartObject createFromByteArray(byte[] data) throws IOException(Code) | | Create a message object from a serialized byte array.
Parameters: data - a serialized byte array of a message object the multipart message object exception: IOException - if any I/O errors occur |
createMessagePart | static MessagePart createMessagePart(DataInputStream dis) throws IOException(Code) | | Create a new message part from the input stream
Parameters: dis - the data input stream for reading exception: IOException - if any I/O errors occur the message object instance |
fixupReceivedMessageAddresses | public void fixupReceivedMessageAddresses(String senderAddress, String myAddress)(Code) | | Prepares a received message to be sent right back to the sender.
Removes this device's address from the "to" and "cc"
address lists and sets the sender's address as the first "to" address.
Parameters: senderAddress - the sender's address. Should not include the "mms://" prefix, and may contain the ":appID" suffix. May be null. Parameters: myAddress - this device's address. Must not be null. |
getAddress | public java.lang.String getAddress()(Code) | | Returns the "from" address associated with this message, e.g. address of
the sender. If the message is a newly created message, e.g. not a
received one, then the first "to" address is returned.
Returns null if the "from" or "to" address for the
message, dependent on the case, are not set.
Note: This design allows sending responses to a received message easily
by reusing the same Message object and just replacing the
payload. The address field can normally be kept untouched (unless the
used messaging protocol requires some special handling of the address).
the "from" or "to" address of this message, or null if the address that is expected as a result of this method is notset See Also: MultipartObject.setAddress(String) |
getAddressList | Vector getAddressList(String type)(Code) | | Gets the requested address list.
Parameters: type - the address list to be returned, either "to", "cc" or "bcc" exception: IllegalArgumentException - if some other address list type is requested a list of addresses |
getAddresses | public java.lang.String[] getAddresses(java.lang.String type)(Code) | | Gets the addresses of the multipart message of the specified type (e.g.
"to", "cc", "bcc" or "from") as String . The method is not
case sensitive.
Parameters: type - the type of addresses to return the addresses as a String array or null if this value is not present. |
getApplicationID | public String getApplicationID()(Code) | | Returns the destination application identifier.
the destination application identifier, or null if none is set |
getAsByteArray | public byte[] getAsByteArray() throws IOException(Code) | | Gets the message object as a byte array.
exception: IOException - if any I/O errors occur the serialized byte array of the message object |
getBodyAsByteArray | public byte[] getBodyAsByteArray() throws IOException(Code) | | Gets the message object body as a byte array. The body is composed of a
single header that states the number of entries, followed by a serialized
array of MessagePart objects.
throws: IOException - if any I/O errors occur. the serialized byte array of the message body. |
getHeader | public java.lang.String getHeader(java.lang.String headerField)(Code) | | Gets the content of the specific header field of the multipart message.
Parameters: headerField - the name of the header field as a String the content of the specified header field as a String or null of the specified headerfield is not present. exception: SecurityException - if the access to specified header field is restricted exception: IllegalArgumentException - if headerField is unknown See Also: Appendix See Also: D for known headerFields See Also: MultipartObject.setHeader |
getHeaderAsByteArray | public byte[] getHeaderAsByteArray() throws IOException(Code) | | Gets the message object header as a byte array. The header is composed of
a number of fields and is exclusive of the MessagePart
contents.
throws: IOException - if any I/O errors occur. the serialized byte array of the message object |
getHeaderFieldIndex | static int getHeaderFieldIndex(String headerField)(Code) | | Gets the location of the requested header from the
list of allowed header fields.
Parameters: headerField - the header field key to be checked the index of the requested header field, or -1 if the header is not supported |
getMessagePart | public MessagePart getMessagePart(java.lang.String contentID)(Code) | | This method returns a MessagePart from the message that
matches the content-id passed as a parameter.
Parameters: contentID - the content-id for the MessagePart to bereturned MessagePart that matches the provided content-id ornull if there is no MessagePart in thismessage with the provided content-id exception: NullPointerException - if the parameter is null |
getMessageParts | public MessagePart[] getMessageParts()(Code) | | Returns an array of all MessagePart s of this message.
array of MessagePart s, or null if noMessagePart s are available |
isAllowedToAccessHeaderField | boolean isAllowedToAccessHeaderField(String field)(Code) | | Checks if allowed to access the requested header field.
Parameters: field - the header field key to check true if the header exists |
isKnownHeaderField | static boolean isKnownHeaderField(String headerField)(Code) | | Checks if header field is known.
Parameters: headerField - the header field key to check true if the header is known |
readVector | static void readVector(DataInputStream dis, Vector v, boolean isAddress) throws IOException(Code) | | Reads a vector from an input stream. If the content is an MMS Address,
as indicated by the isAddress parameter, then the prefix
"mms://" is added to each address.
Parameters: dis - the data input stream for reading Parameters: v - the array to be returned Parameters: isAddress - the contents are MMS Addresses exception: IOException - if any I/O errors occur |
removeMessagePart | public boolean removeMessagePart(MessagePart part)(Code) | | Removes a MessagePart from the multipart message.
Parameters: part - MessagePart to delete true if it was possible to remove theMessagePart , else false exception: NullPointerException - id the parameter is null |
removeMessagePartId | public boolean removeMessagePartId(java.lang.String contentID)(Code) | | Removes a MessagePart with the specific
contentID from the multipart message.
Parameters: contentID - identifies which MessagePart must bedeleted. true if it was possible to remove theMessagePart , else false exception: NullPointerException - if the parameter is null |
removeMessagePartLocation | public boolean removeMessagePartLocation(java.lang.String contentLocation)(Code) | | Removes MessagePart s with the specific content location
from the multipart message. All MessagePart s with the
specified contentLocation are removed.
Parameters: contentLocation - content location (file name) of the MessagePart true if it was possible to remove theMessagePart , else false exception: NullPointerException - if the parameter is null |
setFromAddress | public void setFromAddress(String fromAddress)(Code) | | Sets the "from" address.
Parameters: fromAddress - the return address, which may be null |
setStartContentId | public void setStartContentId(java.lang.String contentId)(Code) | | Sets the Content-ID of the start MessagePart of
a multipart related message. The Content-ID may be set to
null . The StartContentId is set for the
MessagePart that is used to reference the other MessageParts of the
MultipartMessage for presentation or processing purposes.
Parameters: contentId - as a String exception: java.lang.IllegalArgumentException - if contentId is none of the added MessagePart objects matches thecontentId See Also: MultipartObject.getStartContentId() |
setupHeaderFields | void setupHeaderFields()(Code) | | Sets default values for all allowed header fields.
|
writeMessagePart | static void writeMessagePart(DataOutputStream dos, MessagePart p) throws IOException(Code) | | Writes a message part to the output stream
Parameters: dos - the data output stream for writing Parameters: p - the message part to be written exception: IOException - if any I/O errors occur |
writeVector | static void writeVector(DataOutputStream dos, Vector v, boolean isAddress) throws IOException(Code) | | Writes a vector to an output stream. If the contents are MMS addresses,
as indicated by the isAddress parameter, then
only the device
part of the address is placed into the vector, not the
application-id, if any.
Parameters: dos - the data output stream for writing Parameters: v - the array to be written Parameters: isAddress - is the contents of the vector an MMS address. exception: IOException - if any I/O errors occur |
|
|