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();
}
}
- 上一篇 »BlueHost印度主机速度怎么样
- 下一篇 »Python3 else语句和with语句