public static void read()throws Exception
{
RandomAccessFile rf = new RandomAccessFile("ran.txt","r");
rf.seek(8);
byte[] bt = new byte[4];
rf.read(bt);
String name = new String(bt);
int age = rf.readInt();
System.out.println(name);
System.out.println("age="+age);
rf.close();
}
public static void write_1()throws Exception
{
RandomAccessFile rf = new RandomAccessFile("ran.txt","rw");
rf.write("李四".getBytes());
rf.writeInt(97);
rf.write("王五".getBytes());
rf.writeInt(99);
rf.close();
}