net.rim.device.api.io
Class SmsAddress

java.lang.Object
  extended by net.rim.device.api.io.DatagramAddressBase
      extended by net.rim.device.api.io.SmsAddress

public final class SmsAddress
extends DatagramAddressBase

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

See Also:
Connector, SMSPacketHeader
Since:
BlackBerry API 4.0.0

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
NONE, _address, _key
 
Constructor Summary
SmsAddress()
          Constructs a new, empty SmsAddress object with no header information.
SmsAddress(String address)
          Constructs a new SmsAddress object based on a formatted string.
SmsAddress(DatagramAddressBase addressBase)
          Constructs a new SmsAddress based on a given DatagramAddressBase object.
 
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 hash 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

ORIGINATOR_PORT_INDEX

public static final byte ORIGINATOR_PORT_INDEX
See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

DESTINATION_PORT_INDEX

public static final byte DESTINATION_PORT_INDEX
See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

PORT_NBS_VCARD

public static final int PORT_NBS_VCARD
NBS vCard port

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

PORT_NBS_VCALENDAR

public static final int PORT_NBS_VCALENDAR
NBS vCalendar port

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

PORT_NBS_RING_TONE

public static final int PORT_NBS_RING_TONE
NBS ring tone port

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

PORT_NBS_SIMPLE_EMAIL

public static final int PORT_NBS_SIMPLE_EMAIL
NBS simple email port

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0

PORT_WAP_PUSH

public static final int PORT_WAP_PUSH
WAP Push connectionless session service (client side) port

See Also:
Constant Field Values
Since:
BlackBerry API 4.0.0


Constructor Detail

SmsAddress

public SmsAddress()
Constructs a new, empty SmsAddress object with no header information.

Since:
BlackBerry API 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:
BlackBerry API 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:
BlackBerry API 4.0.0


Method Detail

getHeader

public SMSPacketHeader getHeader()
Gets the SMS packet header.

Returns:
The packet header assocaited with this SMSAddress.
Since:
BlackBerry API 4.0.0

getPorts

public int[] getPorts()
Get the socket port(s).

Returns:
An integer array of socket port(s).
Since:
BlackBerry API 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:
BlackBerry API 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:
BlackBerry API 4.0.0

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.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 4.0.0

hashCode

public int hashCode()
Description copied from class: DatagramAddressBase
Retrieves hash of this object's address.

Overrides:
hashCode in class DatagramAddressBase
Returns:
Hash of this object's address, or 7 if this object has a null address.
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 4.0.0

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:
BlackBerry API 4.0.0





Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.