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){}
本文地址:http://com.8s8s.com/it/it15629.htm