public long write(OplogFile olf) throws IOException {
      long bytesWritten = 0;
      writeByte(olf, opCode);
      bytesWritten++;
      if (opCode == OPLOG_NEW_ENTRY_BASE_ID) {
        writeLong(olf, newEntryBase);
        bytesWritten += 8;
      } else if (opCode == OPLOG_DISK_STORE_ID) {
        writeLong(olf, diskStoreId.getLeastSignificantBits());
        writeLong(olf, diskStoreId.getMostSignificantBits());
        bytesWritten += 16;
      } else if (opCode == OPLOG_MAGIC_SEQ_ID) {
        write(olf, magic.getBytes(), OPLOG_TYPE.getLen());
        bytesWritten += OPLOG_TYPE.getLen();
      } else if (opCode == OPLOG_RVV) {
        write(olf, value);
        bytesWritten += value.getLength();
      } else if (opCode == OPLOG_GEMFIRE_VERSION) {
        writeOrdinal(olf, gfversion);
        bytesWritten++;
      } else if (opCode == OPLOG_CONFLICT_VERSION) {
        if (drIdLength > 0) {
          write(olf, drIdBytes, drIdLength);
          bytesWritten += drIdLength;
        }
        if (versionsBytes != null && versionsBytes.length > 0) {
          write(olf, versionsBytes, versionsBytes.length);
          bytesWritten += versionsBytes.length;
        }
      } else {
        if (!notToUseUserBits) {
          writeByte(olf, userBits);
          bytesWritten++;
        }
        if (deltaIdBytesLength > 0) {
          write(olf, deltaIdBytes, deltaIdBytesLength);
          bytesWritten += deltaIdBytesLength;
          // writeLong(olf, this.newEntryBase); bytesWritten += 8; // HACK DEBUG
        }
        if (drIdLength > 0) {
          write(olf, drIdBytes, drIdLength);
          bytesWritten += drIdLength;
        }
        if (EntryBits.isWithVersions(userBits) && versionsBytes != null
            && opCode != OPLOG_DEL_ENTRY_1ID) {
          write(olf, versionsBytes, versionsBytes.length);
          bytesWritten += versionsBytes.length;
        }
        if (needsValue) {
          int len = value.getLength();
          writeInt(olf, len);
          bytesWritten += 4;
          if (len > 0) {
            write(olf, value);
            bytesWritten += len;
          }
        }
        if (keyBytes != null) {
          writeInt(olf, keyBytes.length);
          bytesWritten += 4;
          if (keyBytes.length > 0) {
            write(olf, keyBytes, keyBytes.length);
            bytesWritten += keyBytes.length;
          }
        }
      }

      writeByte(olf, END_OF_RECORD_ID);
      bytesWritten++;
      return bytesWritten;
    }
Returns the offset to the first byte of the value bytes.
geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java