|
|
Java操作文本文件中的中文 |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
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){}
|
|
相关文章:相关软件: |
|