try{
randomaccessfile rf=new randomaccessfile("e:\\my.txt","rw");
string str="中文";
byte [] b;
b=str.getbytes();
rf.write(b);//中文就写入文本文件了。
}
catch(exception e){}
try{
bufferedreader br=new bufferedreader(new filereader("e:\\my.txt"));
while((line=br.readline())!=null)
{
system.out.println(line);//读取文件
}}
catch(exception e){}