public class Message
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
SmtpMessage
,
SmsMessage
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
ACK_TIME
See
getProperty(String key) for more information |
static int |
MT_BINARY
Message type: binary data
|
static int |
MT_STATUS
Message type: Status report.
|
static int |
MT_TEXT
Message type: text (Default)
|
static int |
SENDER_TYPE_ALPHA
Sender address is alphanumeric
|
static int |
SENDER_TYPE_GUESS
Type (numeric/alphanumeric) of sender address will be guessed
|
static int |
SENDER_TYPE_NUMBER
Sender address is a numeric
|
Constructor and Description |
---|
Message()
Creates an empty message
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns an exact copy of the Message
|
byte[] |
getBytes()
Get the raw message data.
|
java.lang.String |
getID()
Returns the ID of this message.
|
java.lang.String |
getMessage()
Get the message body.
|
java.lang.Object |
getProperty(java.lang.String key)
Returns the value of the specified key that is associated with this message.
|
java.lang.String |
getRecipient()
Get the recipient of this message.
|
java.lang.String |
getSender()
Get the sender of this message.
|
int |
getSenderType()
Returns the Type of sender address.
|
java.util.Date |
getTimestamp()
Get the date where the message was sent / received.
|
int |
getType()
Returns the message type.
|
void |
setID(java.lang.String id)
Set the ID of the Message.
|
void |
setMessage(byte[] bytes)
Set the message data.
|
void |
setMessage(java.lang.String message)
Set the message body.
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Associate a key/value pair with this message.
|
void |
setRecipient(java.lang.String recipient)
Set the recipient for this message.
|
void |
setSender(java.lang.String sender)
Set the sender of this message.
|
void |
setSenderType(int type)
Set the type of the sender address.
|
void |
setType(int type)
Set the message type.
|
java.lang.String |
toString()
Constructs a string representation of this Message
|
public static final int MT_TEXT
public static final int MT_BINARY
public static final int MT_STATUS
public static final int SENDER_TYPE_ALPHA
public static final int SENDER_TYPE_NUMBER
public static final int SENDER_TYPE_GUESS
public static final java.lang.String ACK_TIME
getProperty(String key)
for more informationpublic java.lang.String getID()
public void setID(java.lang.String id)
id
- the Message ID to setpublic void setType(int type)
type
- the type of message (MT_TEXT or MT_BINARY)java.lang.IllegalArgumentException
- if an invalid type is specifiedpublic int getType()
public void setRecipient(java.lang.String recipient)
recipient
- address of the recipientpublic java.lang.String getRecipient()
public java.lang.String getSender()
public void setSender(java.lang.String sender)
public java.lang.String getMessage()
public byte[] getBytes()
public void setMessage(java.lang.String message)
message
- the message.public void setMessage(byte[] bytes)
bytes
- the raw message data.public java.lang.Object getProperty(java.lang.String key)
Use the key ACK_TIME
to get the time it took for the SMSC to
acknowledge a sent SMS. The value returned for ACK_TIME is of type Long.
public java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
public java.util.Date getTimestamp()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.lang.Object
public void setSenderType(int type) throws java.lang.IllegalArgumentException
Notice: The GsmSmsService does not support alphanumeric originators, therefore setting the sender type has no effect for Messages sent through GsmSmsService.
type
- the address type. Allowed parameters are: SENDER_TYPE_ALPHA
,
SENDER_TYPE_NUMBER
, SENDER_TYPE_GUESS
.java.lang.IllegalArgumentException
public int getSenderType()
SENDER_TYPE_ALPHA
, SENDER_TYPE_NUMBER
or
SENDER_TYPE_GUESS
.object XP, Inc. © 2000-2013. All rights reserved object XP