org.mobicents.protocols.smpp.gsm
Class UserDataImpl

java.lang.Object
  extended by org.mobicents.protocols.smpp.gsm.UserDataImpl
All Implemented Interfaces:
UserData

public class UserDataImpl
extends Object
implements UserData

Implementation of UserData.

This implementation automatically handles the inclusion of the concatenated SMS HeaderElement. Calling code should not attempt to add a ConcatenatedSms header element via addHeaderElement(HeaderElement).

Version:
$Id: UserDataImpl.java 486 2010-02-15 10:48:15Z orank $

Constructor Summary
UserDataImpl()
          Create a new UserDataImpl that uses 8-bit reference numbers, if concatenated SMS is required.
UserDataImpl(boolean useConcat16)
          Create a new UserDataImpl.
 
Method Summary
 void addHeaderElement(HeaderElement element)
          Add a HeaderElement to this user data implementation.
 byte[] getData()
          Get the payload of this user data.
 boolean isMultiMessage()
          Calculate if this user data requires multiple SMS segments.
 void setData(byte[] data)
          Set the payload of this user data.
 byte[][] toSegments()
          Get the user data SMS segments.
 byte[] toSingleSms()
          Get the user data as a single message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDataImpl

public UserDataImpl()
Create a new UserDataImpl that uses 8-bit reference numbers, if concatenated SMS is required.


UserDataImpl

public UserDataImpl(boolean useConcat16)
Create a new UserDataImpl.

Parameters:
useConcat16 - If concatenated SMS is required, pass true for this value to use 16-bit segment reference numbers or false to use 8-bit segment reference numbers.
Method Detail

addHeaderElement

public void addHeaderElement(HeaderElement element)
Add a HeaderElement to this user data implementation.

Specified by:
addHeaderElement in interface UserData
Parameters:
element - The header element to add.
Throws:
IllegalArgumentException - If element is an instance of ConcatenatedSms.

toSingleSms

public byte[] toSingleSms()
Description copied from interface: UserData
Get the user data as a single message. This method only returns normally if UserData.isMultiMessage() returns false.

Specified by:
toSingleSms in interface UserData
Returns:
A byte array containing the encoded user data.

toSegments

public byte[][] toSegments()
Description copied from interface: UserData
Get the user data SMS segments.

Specified by:
toSegments in interface UserData
Returns:
An array of byte arrays, each element contains a single SMS segment.

isMultiMessage

public boolean isMultiMessage()
Description copied from interface: UserData
Calculate if this user data requires multiple SMS segments.

Specified by:
isMultiMessage in interface UserData
Returns:
true if the user data requires multiple SMS segments, false if the data requires only a single SMS.

getData

public byte[] getData()
Description copied from interface: UserData
Get the payload of this user data. This is the data that is included in the message after the user data header has been encoded.

Specified by:
getData in interface UserData
Returns:
The payload of this user data.

setData

public void setData(byte[] data)
Description copied from interface: UserData
Set the payload of this user data.

Specified by:
setData in interface UserData
Parameters:
data - The payload of this user data.
See Also:
UserData.getData()


Copyright © 2011 Mobicents. All Rights Reserved.