java RandomAccessFile 向文件中写入数据,怎么样不覆盖原来的数据

import java.io.IOException;
import java.io.RandomAccessFile;
public class RandomFileAccess {
public static void main(String[] args) throws IOException {
RandomAccessFile raf = new RandomAccessFile("d:/abc.txt", "rw");
// 你需要使用seek设置文件的偏移量
raf.seek(raf.length());
raf.writeChars("ajaxfan");
raf.close();
}
}
路漫漫其修远兮 吾将上下求索
原文地址:https://www.cnblogs.com/hbmlml/p/3967080.html