| |
|
| java.lang.Object com.sun.tck.wma.MessageObject
MessageObject | abstract public class MessageObject implements Message(Code) | | Implements a SMS message for the SMS message connection. This class
contains methods for manipulating message objects and their contents.
Messages can be composed of data and an address. MessageObject contains
methods that can get and set the data and the address parts of a message
separately. The data part can be either
text or binary format. The address part has the format:
sms://[phone_number:][port_number]
and represents the address of a port that can accept or
receive SMS messages.
MessageObject s are instantiated when they are received from the
com.sun.tck.wma.MessageConnection MessageConnection
or by using the
MessageConnection.newMessage(String type)MessageConnection.newMessage message factory. Instances are freed when they
are garbage-collected or when they go out of scope.
|
Field Summary | |
protected String | msgAddress High-level message address. | protected String | msgType High-level message type. | protected long | sentAt The time stamp for a message that was sent. |
Method Summary | |
public String | getAddress() Gets the address from the message object as a String . | abstract public java.util.Date | getTimestamp() Returns the timestamp indicating when this message has been
sent. | abstract public void | setAddress(String addr) Sets the address part of the message object. | public void | setAddress(Message reference) (May be deleted) Set message address, copying the address
from another message. | public void | setTimeStamp(long timestamp) Sets the timestamp for inbound SMS messages. |
msgAddress | protected String msgAddress(Code) | | High-level message address.
|
msgType | protected String msgType(Code) | | High-level message type.
|
sentAt | protected long sentAt(Code) | | The time stamp for a message that was sent.
|
MessageObject | public MessageObject(String type, String address)(Code) | | Creates a Message Object without a buffer.
Parameters: type - The message type: TEXT, BINARY or MULTIPART. Parameters: address - The destination address of the message. |
getAddress | public String getAddress()(Code) | | Gets the address from the message object as a String . If no
address is found in the message, this method returns null .
If the method is applied to an inbound message, the source address is
returned. If it is applied to an outbound message, the destination
address is returned.
The following code sample retrieves the address from a received message.
...
Message msg = conn.receive();
String addr = msg.getAddress();
...
...
The address in string form, or null if no address was set. See Also: MessageObject.setAddress |
getTimestamp | abstract public java.util.Date getTimestamp()(Code) | | Returns the timestamp indicating when this message has been
sent.
Date indicating the timestamp in the message ornull if the timestamp is not set. See Also: MessageObject.setTimeStamp |
setAddress | abstract public void setAddress(String addr)(Code) | | Sets the address part of the message object. The address is a
String and must be in the format:
protocol://phone_number:[port]
The following code sample assigns an address to the Message
object.
...
String addr = "protocol://+123456789";
Message msg = newMessage(MessageConnection.TEXT_MESSAGE);
msg.setAddress(addr);
...
Parameters: addr - The address of the target device. throws: IllegalArgumentException - if the address is not valid. See Also: MessageObject.getAddress |
setAddress | public void setAddress(Message reference)(Code) | | (May be deleted) Set message address, copying the address
from another message.
Parameters: reference - the message who's address will be copied asthe new target address for this message. exception: IllegalArgumentException - if the address is not valid See Also: MessageObject.getAddress |
setTimeStamp | public void setTimeStamp(long timestamp)(Code) | | Sets the timestamp for inbound SMS messages.
Parameters: timestamp - the date indicating the timestamp in the message See Also: MessageObject.getTimeStamp |
|
|
|