public class MMSAddress
extends java.lang.Object
implements java.io.Serializable
A MMS address consists of either an email address or a device address. The syntax for email addresses is defined in RFC822. Device addresses consist of an address and a address type.
The following address types are defined:
MAIL
: An email addressPLMN
: A global phone numberIPv4
: An IPv4 addressIPv6
: An IPv6 addressHere are some examples of valid MMS addresses:
0401234567/TYPE=PLMN +358501234567/TYPE=PLMN "Joe User" <joe@user.org> FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/TYPE=IPv6 192.168.1.30/TYPE=IPv4
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_CUSTOM
Custom address type.
|
static int |
TYPE_EMAIL
eMail address type.
|
static int |
TYPE_IPV4
IPv4 address type.
|
static int |
TYPE_IPV6
IPv6 address type.
|
static int |
TYPE_PLMN
global-phone-number address type.
|
static java.lang.String |
TYPE_PREFIX
Type prefix "/TYPE="
|
Constructor and Description |
---|
MMSAddress(int type,
java.lang.String address)
Construct a MMSAddress of a given type.
|
MMSAddress(java.lang.String address)
Construct an MMSAddress.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this MMSAddress to the specified object.
|
java.lang.String |
getMMSAddress()
Returns the complete MMS address (including the type).
|
int |
getType()
Get the Type of the Address.
|
java.lang.String |
getValue()
Get the value of the Address.
|
int |
hashCode()
Returns a hashcode for this address.
|
java.lang.String |
toString()
Returns the complete MMS address as
String (including the type). |
public static final java.lang.String TYPE_PREFIX
public static final int TYPE_EMAIL
public static final int TYPE_PLMN
public static final int TYPE_IPV4
public static final int TYPE_IPV6
public static final int TYPE_CUSTOM
public MMSAddress(java.lang.String address) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
/TYPE=...
)
is not specified, the type is determined automatically.
Examples:
new MMSAddress("+41123456789"); new MMSAddress("john@user.org"); new MMSAddress("192.168.1.12"); new MMSAddress("0123765/TYPE=PLMN");
address
- the MMS address.java.lang.IllegalArgumentException
- if the type of address cannot be determined.java.lang.NullPointerException
- if the address is null.public MMSAddress(int type, java.lang.String address) throws java.lang.IllegalArgumentException
Examples:
new MMSAddress(MMSAddress.TYPE_EMAIL, "\"John User\" <john@user.org>"); new MMSAddress(MMSAddress.TYPE_PLMN, "+41123456789"); new MMSAddress(MMSAddress.TYPE_IPV4, "129.168.1.55"); new MMSAddress(MMSAddress.TYPE_CUSTOM, "471129/TYPE=UID");
type
- the address type (one of the TYPE_...
constants).address
- the MMS address.java.lang.IllegalArgumentException
- if an unknown type is used.java.lang.IllegalArgumentException
- if the address doesn't match the type.java.lang.IllegalArgumentException
- if the address is empty.public java.lang.String getValue()
public int getType()
public java.lang.String getMMSAddress()
public java.lang.String toString()
String
(including the type).toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
true
if and only if the argument is not
null
and is a MMSAddress
object that contains
the same address type and value.equals
in class java.lang.Object
obj
- the object to compare this MMSAddress
against.true
if the MMSAddress
is equal;
false
otherwise.public int hashCode()
MMSAddress
object is computed by calling hashCode()
on the String
returned by toString()
. If
getMMSAddress
returns null, super.hashCode()
is
returned instead.hashCode
in class java.lang.Object
object XP, Inc. © 2000-2013. All rights reserved object XP