skiplist = new LogSkipList();
RandomAccessFileReader reader = new RandomAccessFileReader(new File(file));
try {
BinaryInputArchive logStream = new BinaryInputArchive(reader);
FileHeader fhdr = new FileHeader();
fhdr.deserialize(logStream, "fileheader");
byte[] bytes = null;
while (true) {
long lastFp = reader.getPosition();
long crcValue;
try {
crcValue = logStream.readLong("crcvalue");
bytes = logStream.readBuffer("txnEntry");
} catch (EOFException e) {
break;
}
if (bytes.length == 0) {
break;
}
Checksum crc = new Adler32();
crc.update(bytes, 0, bytes.length);
if (crcValue != crc.getValue()) {
throw new IOException("CRC doesn't match " + crcValue +
" vs " + crc.getValue());
}
if (logStream.readByte("EOR") != 'B') {
throw new EOFException("Last transaction was partial.");
}
TxnHeader hdr = new TxnHeader();
Record r = SerializeUtils.deserializeTxn(bytes, hdr);