// Now we can fill in the batch control record properly.
Buffer sequence = buffer.toBuffer();
buffer.reset();
buffer.skip(Journal.HEADER_SIZE);
buffer.writeInt(sequence.getLength() - Journal.HEADER_SIZE - Journal.BATCH_SIZE);
buffer.skip(Journal.BATCH_CONTROL_RECORD_MAGIC.length);
if (checksum) {
Checksum adler32 = new Adler32();
adler32.update(sequence.getData(), sequence.getOffset() + Journal.BATCH_CONTROL_RECORD_SIZE, sequence.getLength() - Journal.BATCH_CONTROL_RECORD_SIZE);
buffer.writeLong(adler32.getValue());