FileDocCategorySizeDatePackage
SMSPacket.javaAPI DocphoneME MR2 API (J2ME)4735Wed May 02 18:00:32 BST 2007com.sun.tck.wma.sms

SMSPacket

public class SMSPacket extends MessagePacket
An SMS data packet which is the interface between an application and the data stream. Methods are included to read/write data from/to the data stream, in SMS format.

Fields Summary
private int
msgLength
Length of message
Constructors Summary
public SMSPacket()
Constructs a new SMS data packet with no payload (Empty data stream.).


                     
      
        super();
    
public SMSPacket(byte[] payload)
Constructs a new SMS data packet with a data stream (payload)..

param
payload The array of bytes representing the SMS data.

        super(payload);
    
Methods Summary
public java.lang.StringgetAddress()
Gets the address from the data stream.

return
The address.

        return getString();
    
public intgetEncodingType()
Gets the encoding type from the data stream.

return
The encoding type.

        return getInt();
    
public byte[]getMessage(int len)
Gets the message bytes from the data stream.

param
len The number of bytes to read from the stream.
return
The array of bytes read from the data stream.

        return getBytes(len);
    
public intgetMessageLength()
Gets the length, in bytes, of the message from the data stream.

return
The length of the message.

        return getInt();
    
public java.lang.StringgetPhoneNumber()
Gets the phone number from the data stream.

return
The phone number.

        return getString();
    
public intgetPort()
Gets the port from the data stream.

return
The port.

        return getInt();
    
public longgetTimeStamp()
Gets the time stamp from the data stream.

return
The time stamp.

        return getLong();
    
public voidsetAddress(java.lang.String address)
Sets the address that is associated with the message.

param
address The address.

        putString(address);
    
public voidsetEncodingType(int type)
Writes the encoding type to the data stream. The type can be text, ucs2, binary.

param
type The encoding type.

        putInt(type);
    
public voidsetMessage(byte[] msg)
Writes the message bytes to the data stream.

param
msg The array of bytes to write.

        putBytes(msg);
    
public voidsetMessageLength(int msgLen)
Writes the length of the message in the data stream..

param
msgLen The length, in bytes, of the SMS payload.

        msgLength = msgLen;
        putInt(msgLen);
    
public voidsetPhoneNumber(java.lang.String phNum)
Sets the phone number that is associated with the message.

param
phNum The phone number associated with the message.

        putString(phNum);
    
public voidsetPort(int port)
Sets the port that is associated with the message.

param
port The port.

        putInt(port);
    
public voidsetTimeStamp(long timeStamp)
Sets the timestamp that is associated with the message.

param
timeStamp The time stamp.

        putLong(timeStamp);