List of usage examples for org.apache.zookeeper.server.util SerializeUtils deserializeSnapshot
public static void deserializeSnapshot(DataTree dt, InputArchive ia, Map<Long, Integer> sessions) throws IOException
From source file:com.linkedin.helix.tools.ZKLogFormatter.java
License:Apache License
private static void readSnapshotLog(String snapshotPath) throws Exception { FileInputStream fis = new FileInputStream(snapshotPath); BinaryInputArchive ia = BinaryInputArchive.getArchive(fis); Map<Long, Integer> sessions = new HashMap<Long, Integer>(); DataTree dt = new DataTree(); FileHeader header = new FileHeader(); header.deserialize(ia, "fileheader"); if (header.getMagic() != FileSnap.SNAP_MAGIC) { throw new IOException("mismatching magic headers " + header.getMagic() + " != " + FileSnap.SNAP_MAGIC); }/* ww w.ja v a 2 s .com*/ SerializeUtils.deserializeSnapshot(dt, ia, sessions); if (bw != null) { bw.write(sessions.toString()); bw.newLine(); } else { System.out.println(sessions); } traverse(dt, 1, "/"); }