long expectedChecksum = currentBatchBuffer.getLong();
Checksum actualChecksum = new Adler32();
Location nextLocation = goToNextLocation(currentBatch, Location.ANY_RECORD_TYPE, true);
while (nextLocation != null && nextLocation.getType() != Location.BATCH_CONTROL_RECORD_TYPE) {
byte data[] = accessor.readLocation(nextLocation, false);
actualChecksum.update(data, 0, data.length);
nextLocation = goToNextLocation(nextLocation, Location.ANY_RECORD_TYPE, true);
}
if (expectedChecksum != actualChecksum.getValue()) {
throw new IOException("Bad checksum for location: " + currentBatch);
}