public BlockFile(String name, int blockSize) throws IOException {
	this.blockSize = blockSize;
	File f = new File(name);
	file = new RandomAccessFile(f, "rw");
	if (f.exists()){
	    size  = (int) (f.length() / blockSize);
	    if (f.length() % blockSize != 0){
		file.setLength(size*blockSize);
	    }
	} 
	else {
	    size  = 0;
	}
    }