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();}}
时间: 2024-12-28 23:46:27