資源簡(jiǎn)介
發(fā)送彩信如何生成smil文件,壓縮包里面有兩個(gè)文件,都可以,方法大同小異,可以參考下Ambulant-2.2-win32.exe可以播放smil文件

代碼片段和文件信息
package?com.waytide.filter;
import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileReader;
import?java.io.FileWriter;
import?java.io.IOException;
public?class?makeSmil?
{
//smil文件存放路徑
private?String?filepath=““;
//smil文件名稱
private?String?filename=““;
//smil文件內(nèi)容
private?String?filecontent=““;
//記錄文本文件數(shù)量(寫入彩信中文件條數(shù))
private?int?filetxt=0;
//設(shè)置文件存放路徑
public?void?setSmilPath(String?path)
{
this.filepath=path;
//如果目錄不存在,則創(chuàng)建
File?rootDir=new?File(this.filepath);
if(!rootDir.isDirectory())
{
rootDir.mkdirs();
}
}
public?String?getSmilPath()
{
return?this.filepath;
}
//設(shè)置smil文件名稱
public?void?setSmilName(String?name)
{
this.filename=name;
}
public?String?getSmilName()
{
return?this.filename;
}
//重置smil文件
public?void??resetSmil()
{
this.filecontent=““;
}
//為smil文件加入頭部信息
public?void??smilAddHead()
{
this.filecontent=?“lns=\“http://www.w3.org/2001/SMIL20/CR/Language\“>“;
this.filecontent+=“\n??“;
this.filecontent+=“\n????“;
this.filecontent+=“\n?????? “;
this.filecontent+=“\n?????? “;
this.filecontent+=“\n?????? “;
this.filecontent+=“\n???? “;
this.filecontent+=“\n??“;
this.filecontent+=“\n??“;
}
//設(shè)置彩信開始標(biāo)記及彩信播放時(shí)間
public?void?setSmilParStart(int?time)
{
this.filecontent+=“\n????“;
}
//設(shè)置彩信結(jié)尾標(biāo)記
public?void?setSmilParEnd()
{
this.filecontent+=“\n???? “;
}
//設(shè)置彩信片斷開始標(biāo)記
public?void?setSmilSeqStart()
{
this.filecontent+=“\n??????“;
}
//設(shè)置彩信片斷結(jié)束標(biāo)記
public?void?setSmilSeqEnd()
{
this.filecontent+=“\n?????? “;
}
//設(shè)置彩信聲音
public?void?smilAddAudio(String?audio)
{
this.filecontent+=“\n????“;
}
//給文件添加文字內(nèi)容
public?void?smilAddTxt(String?strint?time)
{
filetxt++;
FileWriter?fw;
try?
{
fw?=?new?FileWriter(this.filepath+this.filename+filetxt+“.txt“);
fw.write(str0str.length());
fw.flush();
fw.close();
}
catch?(IOException?e)
{
e.printStackTrace();
}
this.filecontent+=“\n???????? “;
}
//給文件添加圖片
public?void?smilAddImg(String?imgint?time)
{
this.filecontent+=“\n????????
“;
}
//給文件添加尾部信息
public?void?smilAddFoot()
{
this.filecontent+=“\n??“;
this.filecontent+=“\n “;
}
//生成彩信smil文件
public?void?generateSmil()
{
FileWriter?fw;
try?
{
fw?=?new?FileWriter(this.filepath+this.filename+“.smil“);
fw.write(this.filecontent0this.filecontent.length());
fw.flush();
fw.close();
}?
catch?(IOException?e)
{
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????9767??2011-07-29?13:16??如何生成SMIL.txt
?????文件????9141461??2011-07-25?13:02??Ambulant-2.2-win32.exe
?????文件???????4558??2009-08-07?18:27??makeSmil.java
?????文件??????11475??2011-07-25?20:43??smil學(xué)習(xí)筆記.txt
-----------?---------??----------?-----??----
??????????????9167261????????????????????4
評(píng)論
共有 條評(píng)論