code: public long setRecord(final long iPosition, final ORecordId iRid, final byte[] iContent) throws IOException {
      acquireExclusiveLock();
      try {
  
        long[] pos = getRelativePosition(iPosition);
        final OFile file = files[(int) pos[0]];
  
        final int recordSize = file.readInt(pos[1]);
        final int contentLength = iContent != null ? iContent.length : 0;
  
        if (contentLength == recordSize) {
          // USE THE OLD SPACE SINCE SIZE ISN'T CHANGED
          file.write(pos[1] + RECORD_FIX_SIZE, iContent);
  
          OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_ALL, +1);
          return iPosition;
        } else if (recordSize - contentLength > RECORD_FIX_SIZE + 50) {
          // USE THE OLD SPACE BUT UPDATE THE CURRENT SIZE. IT'S PREFEREABLE TO USE THE SAME INSTEAD FINDING A BEST SUITED FOR IT TO
          // AVOID CHANGES TO REF FILE AS WELL.
          writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
  
          // CREATE A HOLE WITH THE DIFFERENCE OF SPACE
          handleHole(iPosition + RECORD_FIX_SIZE + contentLength, recordSize - contentLength - RECORD_FIX_SIZE);
  
          OProfiler.getInstance().updateCounter(PROFILER_UPDATE_REUSED_PARTIAL, +1);
        } else {
          // CREATE A HOLE FOR THE ENTIRE OLD RECORD
          handleHole(iPosition, recordSize);
  
          // USE A NEW SPACE
          pos = getFreeSpace(contentLength + RECORD_FIX_SIZE);
          writeRecord(pos, iRid.clusterId, iRid.clusterPosition, iContent);
  
          OProfiler.getInstance().updateCounter(PROFILER_UPDATE_NOT_REUSED, +1);
        }
  
        return getAbsolutePosition(pos);
  
      } finally {
        releaseExclusiveLock();
      }
    }
docs: Set the record content in file.
  
  @param iPosition
  The previous record's offset
  @param iContent
  The content to write
  @return The new record offset or the same received as parameter is the old space was reused.
  @throws IOException