读写二进制数据
2018年11月22日 星期四
下午5:59
简述大致方法,纯属个人笔记
RandomAccessFile 随机访问文件
RandomAccessFile in = new RandomAccessFile(pathname, “rw”/“r”);
in.seek(3)//设置文件读取的指针
long nbytes = in.length();
int nrecords = (int) (nbytes/ RECORD_SIZE); RECORD_SIZE是每条记录的大小
java.io.RandomAccessFile
RandomAccessFile(String file, String mode)
RandomAccessFile(File file, String mode)
long getFilePointer() 返回文件当前指针位置
void seek(long pos)
long length()