关于读取文件的一个方法
RandomAccessFile f = new RandomAccessFile (filename,"r");
FileChannel fc = f.getChannel();
ByteBuffer fb = ByteBuffer.allocateDirect((int)fc.size());
while(true){
int ret = fc.read(fb);
if (ret == -1)
break;
fb.flip();
}
他们说用这个方法可以快速读取文件,我没看懂,这里没有返回读取的str啊,我要做文本编辑,读取的内容要转换成string给JTextPane,这里怎么才能转换成string啊