out.writeInt(stateStore.size()); // number of entries
// entries
Iterator iterKeys = stateStore.keySet().iterator();
while (iterKeys.hasNext()) {
ItemId id = (ItemId) iterKeys.next();
if (id.denotesNode()) {
out.writeByte(NODE_ENTRY); // entry type
} else {
out.writeByte(PROP_ENTRY); // entry type
}
out.writeUTF(id.toString()); // id
byte[] data = (byte[]) stateStore.get(id);
out.writeInt(data.length); // data length
out.write(data); // data
}
} finally {
out.close();
}
// write references
fsRes = new FileSystemResource(wspFS, REFS_FILE_PATH);
fsRes.makeParentDirs();
bos = new BufferedOutputStream(fsRes.getOutputStream());
out = new DataOutputStream(bos);
try {
out.writeInt(refsStore.size()); // number of entries
// entries
Iterator iterKeys = refsStore.keySet().iterator();
while (iterKeys.hasNext()) {
NodeReferencesId id = (NodeReferencesId) iterKeys.next();
out.writeUTF(id.toString()); // target id
byte[] data = (byte[]) refsStore.get(id);
out.writeInt(data.length); // data length
out.write(data); // data
}
} finally {