Hello friends,

In my application (JSR120) I am getting message as BinaryMessage.

Can I convert this BinaryMessage into TextMessage.

If so, please tell me how to do this?

I have written the code like this:
public void notifyIncomingMessage(MessageConnection conn)
{
if (thread == null)
{
thread = new Thread(this);
thread.start();
}
}

public void run()
{
String msgData = null;
try
{
msg = smsconn.receive();
if (msg != null)
{
senderAddress = msg.getAddress();
if (msg instanceof TextMessage)
{
msgData = ((TextMessage)msg).getPayloadText();
}
else
if (msg instanceof BinaryMessage)
{
StringBuffer buf = new StringBuffer();
byte[] data = ((BinaryMessage)msg).getPayloadData();

for (int i = 0; i < data.length; i++)
{
int intData = (int)data[i] & 0xFF;
if (intData < 0x10)
{
buf.append("0");
}
buf.append(Integer.toHexString(intData));
buf.append(' ');
}


msgData = buf.toString();
}
else
if(msg instanceof MultipartMessage)
{
System.out.println("message is MultipartMessage.\n");
}
}

Here I am BinaryMessage. I want to convert it into a TextMessage.
Please can any one help?