public class MMSMessage
extends java.lang.Object
implements java.io.Serializable
MMSMessagePart
are displayed.
Use the subclass SMILMessage
if
you want to define the presentation with SMIL.
Example:
MMSMessage msg = new MMSMessage(); // add a image msg.addMessagePart(new Image(new FileInputStream("ocean.jpg"), "sun.jpg", "image/jpeg")); // add a text msg.addMessagePart(new Text("dive deep")); // add binary data msg.addMessagePart(new GenericMessagePart("application/octet-stream", new byte[]{...., 0x01, 0x02, 0x03, 0x04, 0x05,....})); // add destination address msg.addTO(new MMSAddress(MMSAddress.TYPE_PLMN, "0785555555")); // add subject (optional) msg.setSubject("My first MMS");
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_ADVERTISEMENT
Message class: Advertisement
|
static java.lang.String |
CLASS_AUTO
Message class: Auto
|
static java.lang.String |
CLASS_INFORMATIONAL
Message class: Informational
|
static java.lang.String |
CLASS_PERSONAL
Message class: Personal
|
static java.lang.String |
CONTENT_TYPE_MIXED
Content-Type: application/vnd.wap.multipart.mixed
|
static java.lang.String |
CONTENT_TYPE_RELATED
Content-Type: application/vnd.wap.multipart.related
|
static java.lang.String |
PRIORITY_HIGH
Priority: High
|
static java.lang.String |
PRIORITY_LOW
Priority: Low
|
static java.lang.String |
PRIORITY_NORMAL
Priority: Normal
|
static java.lang.String |
VERSION_1_0
MMS Version 1.0
|
static java.lang.String |
VERSION_1_1
MMS Version 1.1
|
static java.lang.String |
VERSION_1_2
MMS Version 1.2
|
static java.lang.String |
VERSION_1_3
MMS Version 1.3
|
Constructor and Description |
---|
MMSMessage() |
Modifier and Type | Method and Description |
---|---|
void |
addBCC(MMSAddress address)
Add an address to the list of 'BCC' (blind carbon-copy) addresses.
|
void |
addCC(MMSAddress address)
Add an address to the list of 'CC' (carbon-copy) addresses.
|
void |
addMessagePart(MMSMessagePart part)
Add a
message part to this message. |
void |
addTO(MMSAddress address)
Add an address to the list of 'TO' addresses.
|
boolean |
containsHeader(java.lang.String name)
Returns a boolean indicating whether the named MMS header has already been set.
|
void |
export(java.lang.String directory)
Export the content of this MMS message to the given directory.
|
java.lang.Boolean |
getAdaptationAllowed()
Determine if content adaptation is allowed.
|
java.lang.String |
getApplicationId()
Get the ID of the destination application.
|
java.lang.String |
getAuxApplicationInfo()
Get the auxiliary application Information.
|
java.util.Iterator |
getBCC()
Get an Iterator over all recipients in the 'BCC' list.
|
java.util.Iterator |
getCC()
Get an Iterator over all recipients in the 'CC' list.
|
ContentClass |
getContentClass()
Get the content class of this message.
|
java.lang.String |
getContentType()
Returns the MIME content-type for this message.
|
java.util.Date |
getDeliveryDate()
Get the Date/Time of desired delivery.
|
boolean |
getDeliveryReport()
Specifies whether the originator MMS Client requests a delivery report
from each recipient.
|
java.lang.Boolean |
getDRMContent()
Get the DRM indication for this message.
|
java.util.Date |
getExpiryDate()
Get the Date/Time until the MMS Message will be stored in the MMSC.
|
MMSAddress |
getFrom()
Get the address of the originator MMS Client.
|
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified MMS header as a String.
|
java.util.Enumeration |
getHeaderNames()
Returns an enumeration of all the header names this message contains.
|
java.lang.String |
getMessageClass()
Get the message class.
|
java.lang.String |
getMessageId()
This is an unique reference assigned to the MMSMessage.
|
java.util.List |
getMessageParts()
Get a list of message parts for this message.
|
java.lang.String |
getPriority()
Get the priority of the MMS message assigned by the originator MMS Client.
|
java.lang.Object |
getProperty(java.lang.String key)
Returns the value of the specified key that is associated with this message.
|
boolean |
getReadReport()
Specifies whether the originator MMS Client wants a read report from each recipient.
|
java.lang.String |
getReplyApplicationId()
Get the ID of the application to which replies, delivery reports and read
reports are addressed.
|
ReplyCharging |
getReplyCharging()
Get the Reply Charging field for this message.
|
java.util.Date |
getReplyChargingDeadLine()
Get the reply charging deadline.
|
java.lang.String |
getReplyChargingId()
The reply charging ID is only present if the MMSMessage is a reply to a
offering MMSMessage which had set the
reply charging field
set to ReplyCharging.ACCEPTED or ReplyCharging.ACCEPTED_TEXT_ONLY . |
int |
getReplyChargingSize()
Get the reply charging size.
|
java.lang.String |
getSubject()
Get the subject of the MMS message.
|
java.util.Date |
getSubmissionDate()
Get the Date/Time of submission of the MMSMessage.
|
java.util.Iterator |
getTO()
Get an Iterator over all recipients in the 'TO' list.
|
java.lang.String |
getTransactionId()
Get the unique Transaction Identifier for this Message.
|
java.lang.String |
getVersion()
Get the MMS version for this message.
|
boolean |
isSenderVisible()
Returns true if the sender address is visible to the recipient, false otherwise.
|
static MMSMessage |
parseMMSEncoding(byte[] mmsenc)
Deprecated.
use
MM1Service.parseMMSEncoding(byte[]) instead. |
static MMSMessage |
parseMMSEncoding(java.io.InputStream in)
Deprecated.
use
MM1Service.parseMMSEncoding(InputStream) instead. |
boolean |
removeBCC(MMSAddress address)
Removes the given address from the list of 'BCC' addresses.
|
boolean |
removeCC(MMSAddress address)
Removes the given address from the list of 'CC' addresses.
|
boolean |
removeTO(MMSAddress address)
Removes the given address from the list of 'TO' addresses.
|
void |
setAdaptationAllowed(java.lang.Boolean adaptions)
Indicate if the VASP allows adaptation of the content.
|
void |
setApplicationId(java.lang.String id)
Set the ID of the destination application.
|
void |
setAuxApplicationInfo(java.lang.String info)
Set the auxiliary application Information.
|
void |
setContentClass(ContentClass contentClass)
Sets the content class of this message.
|
void |
setContentType(java.lang.String contentType)
Set the content type for this MMS message.
|
void |
setDeliveryDate(java.util.Date date)
Set the time of desired delivery.
|
void |
setDeliveryReport(boolean report)
Specifies whether the originator MMS Client requests a delivery report
from each recipient.
|
void |
setDRMContent(java.lang.Boolean drm)
Indicate if the message contains DRM-protected content.
|
void |
setExpiryDate(java.util.Date date)
Length of time the message will be stored in MMSC or time
to delete the message.
|
void |
setFrom(MMSAddress address)
Set the address of the originator MMS Client.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets an additional MMS header with the given name and value.
|
void |
setMessageClass(java.lang.String msgClass)
Set the message class.
|
void |
setMessageId(java.lang.String string)
Set the message ID.
|
void |
setPriority(java.lang.String prio)
Priority of the MMS message assigned by the originator MMS Client.
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Associate a key/value pair with this message.
|
void |
setReadReport(boolean report)
Specifies whether the originator MMS Client requests a read report from each
recipient.
|
void |
setReplyApplicationId(java.lang.String id)
Set the ID of the application to which replies, delivery reports and read
reports are addressed.
|
void |
setReplyCharging(ReplyCharging type)
Reply Charging should only be set if the originator is willing
to pay for the Reply-message of the recipient(s).
|
void |
setReplyChargingDeadLine(java.util.Date deadline)
The reply charging deadline specifies the latest time of the recipient(s)
to submit the Reply-message.
|
void |
setReplyChargingId(java.lang.String id)
The reply charging ID field shall be the same as the Message ID
of the original message that is replied to.
|
void |
setReplyChargingSize(int octets)
The reply charging size field shall not be present if the
reply charging field is not present. |
void |
setSenderVisibility(boolean visible)
Show address/phone number of the originator MMS Client to the recipient
unless the former has a secret number/address.
|
void |
setSubject(java.lang.String subject)
Subject of the MMSMessage
|
void |
setSubmissionDate(java.util.Date date)
Set the Date and time of submission of the MMSMessage.
|
void |
setTransactionId(java.lang.String transactionId)
Unique Transaction Identifier.
|
void |
setVersion(java.lang.String version)
Set the MMS version to use.
|
java.lang.String |
toString() |
public static final java.lang.String CONTENT_TYPE_MIXED
public static final java.lang.String CONTENT_TYPE_RELATED
public static final java.lang.String CLASS_PERSONAL
public static final java.lang.String CLASS_ADVERTISEMENT
public static final java.lang.String CLASS_INFORMATIONAL
public static final java.lang.String CLASS_AUTO
public static final java.lang.String PRIORITY_LOW
public static final java.lang.String PRIORITY_NORMAL
public static final java.lang.String PRIORITY_HIGH
public static final java.lang.String VERSION_1_0
public static final java.lang.String VERSION_1_1
public static final java.lang.String VERSION_1_2
public static final java.lang.String VERSION_1_3
public void setTransactionId(java.lang.String transactionId)
transactionId
- the Transaction ID or null if unset.public java.lang.String getTransactionId()
public void setVersion(java.lang.String version) throws java.lang.IllegalArgumentException
If the MMS version is unset, jSMS will use the MMS version configured in your
initialization properties. If no version is configured, it defaults to VERSION_1_1
Please note that for outgoing messages, attributes not supported by
the specified protocol version are silently ignored. E.g. when using MMS
version 1.2
, the attribute contentclass
will be ignored since its only available for MMS version 1.3
.
version
- the MMS version or null to clear it.java.lang.IllegalArgumentException
- if the specified version is unknown.public java.lang.String getVersion()
public void setMessageId(java.lang.String string)
string
- the message ID.public java.lang.String getMessageId()
public void setSubmissionDate(java.util.Date date)
If the field is not provided by the sending MMS Client, the MMSC shall insert the time of arrival of the MMSMessage at the MMSC.
date
- the submission date or null.public java.util.Date getSubmissionDate()
If the field was not provided by the sending MMS Client, the MMSC shall insert the time of arrival of the MMSMessage at the MMSC.
public void setFrom(MMSAddress address)
address
- of the sender or null.public MMSAddress getFrom()
public void addTO(MMSAddress address)
At least one TO/CC/BCC recipient must be set to deliver a MMS.
address
- the address of the recipient.addCC(MMSAddress)
,
addBCC(MMSAddress)
public java.util.Iterator getTO()
MMSAddress
objects.public boolean removeTO(MMSAddress address)
public void addCC(MMSAddress address)
At least one TO/CC/BCC recipient must be set to deliver a MMS.
address
- the address of the recipient.addTO(MMSAddress)
,
addBCC(MMSAddress)
public boolean removeCC(MMSAddress address)
public java.util.Iterator getCC()
MMSAddress
objects.public void addBCC(MMSAddress address)
At least one TO/CC/BCC recipient must be set to deliver a MMS.
address
- the address of the recipient.addTO(MMSAddress)
,
addCC(MMSAddress)
public java.util.Iterator getBCC()
MMSAddress
objects.public boolean removeBCC(MMSAddress address)
public void setSubject(java.lang.String subject)
subject
- public java.lang.String getSubject()
public void setMessageClass(java.lang.String msgClass)
CLASS_AUTO
indicates a message that is automatically generated
by the client and the originator client shall not request a
Delivery-Report
or
Read-Report
.
If the message class is not set, the receiver interprets the
message as CLASS_PERSONAL
.msgClass
- the message class or null.public java.lang.String getMessageClass()
CLASS_PERSONAL
, CLASS_ADVERTISEMENT
,
CLASS_INFORMATIONAL
, CLASS_AUTO
or null if unset.setMessageClass(String)
public void setExpiryDate(java.util.Date date)
date
- of expiry or null.public java.util.Date getExpiryDate()
public void setDeliveryDate(java.util.Date date)
date
- of desired delivery or null for immediate delivery.public java.util.Date getDeliveryDate()
public void setPriority(java.lang.String prio) throws java.lang.IllegalArgumentException
PRIORITY_NORMAL
.prio
- one of PRIORITY_LOW
, PRIORITY_NORMAL
,
PRIORITY_HIGH
or null.java.lang.IllegalArgumentException
- if the priority is not one of PRIORITY_LOW
,
PRIORITY_NORMAL
or PRIORITY_HIGH
.public java.lang.String getPriority()
PRIORITY_LOW
, PRIORITY_NORMAL
,
PRIORITY_HIGH
or null.public void setSenderVisibility(boolean visible)
visible
- public boolean isSenderVisible()
setSenderVisibility(boolean)
public void setDeliveryReport(boolean report)
getMessageClass()
is "Auto",
the field shall always be present and the value shall be false.report
- true if a delivery report is requested.public boolean getDeliveryReport()
public void setReadReport(boolean report)
When getMessageClass()
is set to "Auto", the field shall
always be present and the value shall be false.
report
- true if a read report is requested.public boolean getReadReport()
public void setReplyCharging(ReplyCharging type)
ReplyCharging.REQUESTED
and ReplyCharging.REQUESTED_TEXT_ONLY
are allowed.
The MMSC shall reject an MMSMessage that includes this field if it doesn't support reply-charging.
This attribute is available only with MMS version 1.1 or later.type
- the Reply Charging or null.public ReplyCharging getReplyCharging()
setReplyCharging(ReplyCharging)
public void setReplyChargingDeadLine(java.util.Date deadline)
The reply charging deadline should not be set if the
reply charging
field is not set.
deadline
- the deadline or null.public java.util.Date getReplyChargingDeadLine()
setReplyChargingDeadLine(Date)
public void setReplyChargingSize(int octets)
reply charging
field is not present.
It specifies the maximum size (number of octets) for the Reply-message.
This attribute is available only with MMS version 1.1 or later.octets
- number of octetspublic int getReplyChargingSize()
setReplyChargingSize(int)
public void setReplyChargingId(java.lang.String id)
The reply charging ID shall only be present if this MMSMessage contains the
Reply that was offered by the value 'accepted' or 'accepted text only'
in the reply charging field
of the Original-message
received earlier and if the Reply-Charging limitations are met.
id
- the reply charging ID or null.public java.lang.String getReplyChargingId()
reply charging field
set to ReplyCharging.ACCEPTED
or ReplyCharging.ACCEPTED_TEXT_ONLY
.
The value of this field shall be the same as the Message-ID of the original message that is replied to.
This attribute is available only with MMS version 1.1 or later.public java.lang.String getApplicationId()
public void setApplicationId(java.lang.String id)
id
- the application ID or null to clear the ID.public java.lang.String getReplyApplicationId()
public void setReplyApplicationId(java.lang.String id)
id
- the reply application ID or null to clear the ID.public java.lang.String getAuxApplicationInfo()
public void setAuxApplicationInfo(java.lang.String info)
info
- the auxiliary info or null to clear it.public ContentClass getContentClass()
public void setContentClass(ContentClass contentClass)
contentClass
- the content class or null to clear it.public void setDRMContent(java.lang.Boolean drm)
public java.lang.Boolean getDRMContent()
public void setAdaptationAllowed(java.lang.Boolean adaptions)
public java.lang.Boolean getAdaptationAllowed()
public void setContentType(java.lang.String contentType) throws java.lang.IllegalArgumentException
CONTENT_TYPE_MIXED
.contentType
- the Content-Type.java.lang.IllegalArgumentException
- if an unsupported content-type is set.public java.lang.String getContentType()
CONTENT_TYPE_MIXED
.public void addMessagePart(MMSMessagePart part)
message part
to this message.
It is undefined in which order the parts of a message are presented on
a mobile phone. If you want to have more control over the the presentation,
use a SMILMessage
instead.
part
- the message part to be added.public java.util.List getMessageParts()
MMSMessagePart
objects.public static MMSMessage parseMMSEncoding(byte[] mmsenc) throws ParseException
MM1Service.parseMMSEncoding(byte[])
instead.mmsenc
- byte array holding a MMS structureParseException
- if the MMS structure cannot be converted.public static MMSMessage parseMMSEncoding(java.io.InputStream in) throws java.io.IOException, ParseException
MM1Service.parseMMSEncoding(InputStream)
instead.in
- input stream returning MMS structureParseException
- if the MMS structure cannot be converted.java.io.IOException
- if reading from the input stream fails.public void export(java.lang.String directory) throws java.io.IOException
The MMS message-parts are stored according to their location-name. If the location is not set, they will be numbered.
directory
- the directory where the message-parts are stored. If
this directory does not exist, it will be created.java.io.IOException
- if an I/O error occurs.public void setHeader(java.lang.String name, java.lang.String value)
containsHeader(String)
method can be used to test for the
presence of a header before setting its value.
Trying to set a MMS Header (e.g. From
) that also is accessible
through a setter-method (e.g. setFrom(MMSAddress)
) has no effect.
name
- the name of the header.value
- the header value or null to remove the header.getHeader(String)
,
getHeaderNames()
public java.lang.String getHeader(java.lang.String name)
name
- a String specifying the header name.public boolean containsHeader(java.lang.String name)
name
- the header name.true
if the named header has already been set,
false
otherwise.public java.util.Enumeration getHeaderNames()
public java.lang.Object getProperty(java.lang.String key)
public java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
public java.lang.String toString()
toString
in class java.lang.Object
object XP, Inc. © 2000-2013. All rights reserved object XP