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

TextObject

public class TextObject extends MessageObject implements com.sun.tck.wma.TextMessage
Implements an instance of a text message.

Fields Summary
private byte[]
buffer
Buffer that will hold the text payload.
Constructors Summary
public TextObject(String addr)
Construct a text specific message.

param
addr the destination address of the message.

        super(MessageConnection.TEXT_MESSAGE, addr);
    
Methods Summary
public byte[]getPayloadData()
Gets the raw byte array.

return
an array of raw UCS-2 payload data
see
#getPayloadText
see
#setBytes

        return buffer;
    
public java.lang.StringgetPayloadText()
Returns a String representing the message payload data.

return
null if the payload isn't set, or this message's payload
see
#setPayloadText

        if (buffer == null) {
            return null;
        }
        return TextEncoder.toString(buffer);
    
public voidsetPayloadData(byte[] data)
Sets the raw byte array.

param
data an array of raw UCS-2 payload data.
see
#getBytes

        buffer = data;
    
public voidsetPayloadText(java.lang.String data)
Sets this message's payload data. It may be null.

param
data a String representing the payload data
see
#getPayloadText

        if (data != null) {
            buffer = TextEncoder.toByteArray(data);
        } else {
            buffer = null;
        }