使用随机访问文件
import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; /* nowjava - 时代Java 提 供 */ public class Main { public static void main(String[] args) throws Exception { try { File f = new File("filename"); RandomAccessFile raf = new RandomAccessFile(f, "rw"); // Read a character char ch = raf.readChar(); // Seek to end of file raf.seek(f.length()); // Append to the end/*时 代 J a v a - N o