public static Map<String, Integer> deserializeHashKeys(byte[] bytes, int off, int len) throws IOException {
if (bytes == null || (len == 1 && bytes[off] == 0)) {
return ImmutableMap.of();
}
ByteArrayInputStream bis = new ByteArrayInputStream(bytes, off, len);
BinaryDecoder decoder = new BinaryDecoder(bis);
int size = decoder.readInt();
Map<String, Integer> hashKeys = Maps.newHashMapWithExpectedSize(size);
while (size > 0) {
while (size-- > 0) {
String key = decoder.readString();
int value = decoder.readInt();
hashKeys.put(key, value);
}
size = decoder.readInt();
}
return hashKeys;
}
}