哪位高手能花点时间帮我看一下,我实在不行了!
public class mmsmidlet extends MIDlet{
//省略其他代码
public void notifyIncomingMessage(MessageConnection messconn){
if(messconn == smsConnection){//接受多媒体信息
reader.handleMessage();
}
else if(messconn ==mmsConnection){
new Thread(){
public void run(){
try {
Message mmsMessage = mmsConnection.receive();
if ( mmsMessage!=null ) {
if(mmsMessage instanceof MultipartMessage) {
MultipartMessage multipartMessage =(MultipartMessage)mmsMessage;
String mmsdata1 =mmsMessage.getAddress();
String mmsdata2 =multipartMessage.getTimestamp().toString();
MessagePart[] messageParts = multipartMessage.getMessageParts();
String mmsmessagepart1 =new String(messageParts[0].getContent());
String mmsmessagepart2 =new String(messageParts[1].getContent());
mdbase =new mmsdatabase(mmsdata1,mmsdata2, mmsmessagepart1, mmsmessagepart2);
}
savemmsmessage(mdbase);
}
}catch (
IOException ioe) {
//处理异常
}
}
}.start();
}
}
public void savemmsmessage(mmsdatabase database){//存储多媒体信息到RMS中
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
rss =RecordStore.openRecordStore(fileNames,true);
database.serialize(dos);
byte[] data = baos.toByteArray();
rss.addRecord(data, 0, data.length);
dos.close();