code: public synchronized boolean open(final boolean readOnly) {
  		if (isOpen()) {
  			close();
  		}
  		if (log.isDebugEnabled()) {
  			log.debug("open(" + file + ", " + (readOnly ? "r" : "rw") + ")");
  		}
  		try {
  			if (!readOnly) {
  				osOutput = new FileOutputStream(file, true);
  				fcOutput = osOutput.getChannel();
  			}
  			rafInput = new RandomAccessFile(file, "r");
  			fcInput = rafInput.getChannel();
  			if (readOnly) {
  				fcOutput = fcInput;
  			}
  			offsetOutputUncommited = offsetOutputCommited = fcOutput.size();
  		} catch (Exception e) {
  			log.error("Exception in open()", e);
  			try {
  				close();
  			} catch (Exception ign) {
  			}
  		}
  		validState = isOpen();
  		return validState;
  	}
docs: Open file
  
  @param readOnly open in readOnly mode?
  @return true if valid state