final Map<Long, Object> objectMap = new HashMap<Long, Object>(map.size());
if (binary) {
// WARNING: we can't pass original Data to the user
// TODO: @mm - is there really an advantage of using binary storeAll?
// since we need to do array copy for each item.
BufferObjectDataOutput out = serializationService.createObjectDataOutput(OUTPUT_SIZE);
try {
for (Map.Entry<Long, Data> entry : map.entrySet()) {
entry.getValue().writeData(out);
objectMap.put(entry.getKey(), out.toByteArray());
out.clear();
}
} catch (IOException e) {
throw new HazelcastException(e);
} finally {
IOUtil.closeResource(out);