Java操作文本文件中的中文

发表于:2007-07-01来源:作者:点击数: 标签:
try{
RandomAclearcase/" target="_blank" >ccessFile 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://www.ltesting.net