Code example for RandomAccessFile

Methods: getFilePointer, length, seek

0
 
	private boolean mInit = false;
	private void init() throws IOException { 
		if(mRAFile== null || !mInit) {
			mInit = true;
			mRAFile = new RandomAccessFile(mBase, "rw");
		} 
		if(mRAFile == null) {
			throw new IOException();
		} 
	} 
 
	@Override 
	public synchronized void seek(long point) throws IOException {
		//android.util.Log.v("kiyo", "---------seek---------" + point); 
		init(); 
		mSeek = point;
		if(mSeek <0) {
			mSeek = 0;
		} 
		if(mSeek<mRAFile.length()&&point!=mRAFile.getFilePointer()) {
			mRAFile.seek(mSeek);
		} 
	} 
 
	@Override 
	public synchronized long getFilePointer() {