public void test3()throws Exception{
RandomAccessFile raf4=new RandomAccessFile(new File("lasttest"), "rw");
byte[] b=new byte[1024];
int len;
while((len=raf4.read(b))!=-1){
raf4.seek(2);
System.out.println(new String(b, 0, len));
}
}
}
lasttest中为123456789.
控制台输出结果为
3456789
3456789
3456789
3456789
3456789
3456789
。。。。。无限循环 |
|