net.rim.device.api.io
Class SmsAddress

java.lang.Object
  |
  +--net.rim.device.api.io.DatagramAddressBase
        |
        +--net.rim.device.api.io.SmsAddress

public final class SmsAddress
extends DatagramAddressBase

Formats SMS addresses according to the docs in javax.microedition.io.Connector.

Since:
JDE 4.0.0
See Also:
Connector, SMSPacketHeader

Field Summary
static byte DESTINATION_PORT_INDEX
           
static byte ORIGINATOR_PORT_INDEX
           
static int PORT_NBS_RING_TONE
          NBS ring tone port
static int PORT_NBS_SIMPLE_EMAIL
          NBS simple email port
static int PORT_NBS_VCALENDAR
          NBS vCalendar port
static int PORT_NBS_VCARD
          NBS vCard port
static int PORT_WAP_PUSH
          WAP Push connectionless session service (client side) port
 
Fields inherited from class net.rim.device.api.io.DatagramAddressBase
_address, _key, NONE
 
Constructor Summary
SmsAddress()
          Constructs a new, empty SmsAddress object with no header information.
SmsAddress(DatagramAddressBase addressBase)
          Constructs a new SmsAddress based on a given DatagramAddressBase object.
SmsAddress(String address)
          Constructs a new SmsAddress object based on a formatted string.
 
Method Summary
 boolean equals(Object addressBase)
          Checks whether another DatagramAddressBase object is equal to this SmsAddress.
 String getAddress()
          Get a string representing the SMS address information.
 SMSPacketHeader getHeader()
          Gets the SMS packet header.
 int[] getPorts()
          Get the socket port(s).
 int hashCode()
          Retrieves has of this object's address.
static String makeAddress(boolean open, SMSPacketHeader header, int[] ports)
          Creates an address string based on the given header information.
 void setAddress(String address)
          Sets the address information of the SMSAddress object given a formatted string.
 
Methods inherited from class net.rim.device.api.io.DatagramAddressBase
appendHex, appendHex, getKey, getSubAddress, getSubAddressBase, indexOfNextDelim, parseInt, parseInt, parseLong, readInt, readShort, writeInt, writeShort
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESTINATION_PORT_INDEX

public static final byte DESTINATION_PORT_INDEX
Since:
JDE 4.0.0

ORIGINATOR_PORT_INDEX

public static final byte ORIGINATOR_PORT_INDEX
Since:
JDE 4.0.0

PORT_NBS_RING_TONE

public static final int PORT_NBS_RING_TONE
NBS ring tone port
Since:
JDE 4.0.0

PORT_NBS_SIMPLE_EMAIL

public static final int PORT_NBS_SIMPLE_EMAIL
NBS simple email port
Since:
JDE 4.0.0

PORT_NBS_VCALENDAR

public static final int PORT_NBS_VCALENDAR
NBS vCalendar port
Since:
JDE 4.0.0

PORT_NBS_VCARD

public static final int PORT_NBS_VCARD
NBS vCard port
Since:
JDE 4.0.0

PORT_WAP_PUSH

public static final int PORT_WAP_PUSH
WAP Push connectionless session service (client side) port
Since:
JDE 4.0.0
Constructor Detail

SmsAddress

public SmsAddress()
Constructs a new, empty SmsAddress object with no header information.
Since:
JDE 4.0.0

SmsAddress

public SmsAddress(DatagramAddressBase addressBase)
Constructs a new SmsAddress based on a given DatagramAddressBase object.
Parameters:
addressBase - A DatagramAddressBase to base the new SmsAddress object on. If addressBase is an SmsAddress then the new object is a copy of addressBase. Otherwise a new SmsAddress object is created with the address information from addressBase.
Since:
JDE 4.0.0

SmsAddress

public SmsAddress(String address)
Constructs a new SmsAddress object based on a formatted string.
Parameters:
address - A string in the format specified above in the class description.
Since:
JDE 4.0.0
Method Detail

equals

public boolean equals(Object addressBase)
Checks whether another DatagramAddressBase object is equal to this SmsAddress.
Overrides:
equals in class DatagramAddressBase
Parameters:
addressBase - an address to compare with this SmsAddress
Returns:
true if addressBase is an SmsAddress object with the same address information as this object.
Since:
JDE 4.0.0

getAddress

public String getAddress()
Get a string representing the SMS address information.
Overrides:
getAddress in class DatagramAddressBase
Returns:
A string representing the SMS address in the format described in the SMSAddress class description.
Throws:
IllegalArgumentException - if any of the parameters specified in the address argument are invalid.
Since:
JDE 4.0.0

getHeader

public SMSPacketHeader getHeader()
Gets the SMS packet header.
Returns:
The packet header assocaited with this SMSAddress.
Since:
JDE 4.0.0

getPorts

public int[] getPorts()
Get the socket port(s).
Returns:
An integer array of socket port(s).
Since:
JDE 4.0.0

hashCode

public int hashCode()
Description copied from class: DatagramAddressBase
Retrieves has of this object's address.
Overrides:
hashCode in class DatagramAddressBase
Since:
JDE 4.0.0

Following copied from class: DatagramAddressBase
Returns:
Hash of this object's address, or 7 if this object has a null address.

makeAddress

public static String makeAddress(boolean open,
                                 SMSPacketHeader header,
                                 int[] ports)
Creates an address string based on the given header information.
Parameters:
open - A boolean indicating whether the connection is being opened for sending.
header - The information used to populate the address string. If header is null then a string representing an emptry address is created.
ports - Socket port(s)
Returns:
A formatted string representing the SMS address.
Since:
JDE 4.0.0

setAddress

public void setAddress(String address)
Sets the address information of the SMSAddress object given a formatted string.
Overrides:
setAddress in class DatagramAddressBase
Parameters:
address - A string in the SMS address format specified in the class description.
Throws:
IllegalArgumentException - if address is not properly formatted.
Since:
JDE 4.0.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.