DataTree dt = new DataTree();
Map<Long, Integer> sessions = new ConcurrentHashMap<Long, Integer>();
InputStream snapIS = new BufferedInputStream(new FileInputStream(
snapFile));
CheckedInputStream crcIn = new CheckedInputStream(snapIS, new Adler32());
InputArchive ia = BinaryInputArchive.getArchive(crcIn);
try {
snap.deserialize(dt, sessions, ia);
} catch (IOException ie) {
// we failed on the most recent snapshot
// must be incomplete
// try reading the next one
// after corrupting
snapIS.close();
crcIn.close();
throw ie;
}
long checksum = crcIn.getChecksum().getValue();
long val = ia.readLong("val");
snapIS.close();
crcIn.close();
return (val != checksum);
}