code: public boolean set(final int index, final ByteBuffer buf) {
  		if (!validState) {
  			throw new InvalidStateException();
  		}
  		if (log.isDebugEnabled()) {
  			log.debug("set(" + index + "," + buf + ")");
  		}
  		try {
  			if (buf.limit() > blockSize) {
  				log.error("ERROR: buffer.capacity=" + buf.limit() + " > blocksize=" + blockSize);
  			}
  			if (useMmap) {
  				final MappedByteBuffer mbb = getMmapForIndex(index);
  				if (mbb != null) {
  					mbb.put(buf);
  					return true;
  				}
  				// Fallback to RAF
  			}
  			fileChannel.position(index * blockSize).write(buf);
  			return true;
  		} catch (Exception e) {
  			log.error("Exception in set(" + index + ")", e);
  		}
  		return false;
  	}
docs: Write from buf to file
  
  @param index of block
  @param buf ByteBuffer to write
  @return true if write is OK