public void initialize(long oplogKeyId, byte[] keyBytes, byte[] valueBytes, byte userBits, long drId, VersionTag tag,
boolean notToUseUserBits) throws IOException {
this.opCode = OPLOG_MOD_ENTRY_WITH_KEY_1ID;
this.size = 1;
saveUserBits(notToUseUserBits, userBits);
this.keyBytes = keyBytes;
this.value = new DiskEntry.Helper.CompactorValueWrapper(valueBytes, valueBytes.length);
if (this.userBits == 1 && this.value.getLength() == 0) {
throw new IllegalStateException("userBits==1 and valueLength is 0");
}
this.needsValue = EntryBits.isNeedsValue(this.userBits);
this.size += (4 + this.keyBytes.length);
saveDrId(drId);
initVersionsBytes(tag);
if (this.needsValue) {
this.size += 4 + this.value.getLength();
}
this.deltaIdBytesLength = 0;
{
long delta = calcDelta(oplogKeyId, this.opCode);
this.deltaIdBytesLength = bytesNeeded(delta);
this.size += this.deltaIdBytesLength;
this.opCode += this.deltaIdBytesLength - 1;
for (int i = this.deltaIdBytesLength - 1; i >= 0; i--) {
this.deltaIdBytes[i] = (byte) (delta & 0xFF);
delta >>= 8;
}
}
this.size++;
}