@Override public int serialize(byte[] stream, int offset) { OByteSerializer.INSTANCE.serializeLiteral(TYPE, stream, offset); OIntegerSerializer.INSTANCE.serializeLiteral( value, stream, offset + OByteSerializer.BYTE_SIZE); return OByteSerializer.BYTE_SIZE + OIntegerSerializer.INT_SIZE; }
public Change deserializeChange(final byte[] stream, final int offset) { int value = OIntegerSerializer.INSTANCE.deserializeLiteral( stream, offset + OByteSerializer.BYTE_SIZE); switch (OByteSerializer.INSTANCE.deserializeLiteral(stream, offset)) { case AbsoluteChange.TYPE: return new AbsoluteChange(value); case DiffChange.TYPE: return new DiffChange(value); default: throw new IllegalArgumentException("Change type is incorrect"); } }