@Override public Summary newSummary() { return new GroupDataSummary(); }
@SuppressWarnings("unchecked") @Override public GroupDataSummary copy() { GroupDataSummary copy = new GroupDataSummary(); copy.initialized = initialized; copy.data = CachingGroupData.copy(data); return copy; }
/** * Needed to deserialize an instance of this {@link GroupDataSummary} from a {@link Memory}. * * @param serializedSummary The serialized summary as a {@link Memory} object. * @return A {@link DeserializeResult} representing the deserialized summary. */ public static DeserializeResult<GroupDataSummary> fromMemory(Memory serializedSummary) { byte initialized = serializedSummary.getByte(INITIALIZED_POSITION); int size = serializedSummary.getInt(SIZE_POSITION); byte[] data = new byte[size]; serializedSummary.getByteArray(DATA_POSITION, data, 0, size); GroupData deserializedData = SerializerDeserializer.fromBytes(data); GroupDataSummary deserialized = new GroupDataSummary(); deserialized.initialized = initialized != 0; deserialized.data = deserializedData; // Size read is the size of size and the byte in bytes (DATA_POSITION) plus the size of the data (size) return new DeserializeResult<>(deserialized, size + DATA_POSITION); } }