用RadomAccessFile.readline()方法读取中文出乱码

feifei56124174 2007-10-14 03:14:00
void update()
{
textarea.setText("");
try
{
RandomAccessFile in=new RandomAccessFile("jilu.txt","rw");
long filepoint=0;
while(filepoint<in.length())
{
//String s=in.readLine();
String s=new String(in.readLine().getBytes("iso-8859-1"),"GBK");//转GBK
textarea.append(s+"\n");
filepoint=in.getFilePointer();
}
in.close();
}
catch(Exception e){}
}这是源码,请指教
...全文
187 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
joejoe1991 2007-10-14
  • 打赏
  • 举报
回复
学习

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧