@Test public void serializeFields() throws Exception { final Set<SchemaId> fields = new HashSet<SchemaId>(); fields.add(ids.getSchemaId(UUID.randomUUID())); fields.add(ids.getSchemaId(UUID.randomUUID())); final Set<SchemaId> deserialized = serializationUtil.deserializeFields(serializationUtil.serializeFields(fields)); assertEquals(fields, deserialized); }
byte[] serializeFields(Collection<SchemaId> fields) { final byte[] serialized = new byte[SCHEMA_ID_BYTE_LENGTH * fields.size()]; final Iterator<SchemaId> iterator = fields.iterator(); int idx = 0; while (iterator.hasNext()) { final byte[] bytes = iterator.next().getBytes(); assert SCHEMA_ID_BYTE_LENGTH == bytes.length; System.arraycopy(bytes, 0, serialized, idx * SCHEMA_ID_BYTE_LENGTH, SCHEMA_ID_BYTE_LENGTH); idx++; } return serialized; }
DerefMapSerializationUtil { byte[] serializeFields(Collection<SchemaId> fields) { final byte[] serialized = new byte[SCHEMA_ID_BYTE_LENGTH * fields.size()]; final Iterator<SchemaId> iterator = fields.iterator(); int idx = 0; while (iterator.hasNext()) { final byte[] bytes = iterator.next().getBytes(); assert SCHEMA_ID_BYTE_LENGTH == bytes.length; System.arraycopy(bytes, 0, serialized, idx * SCHEMA_ID_BYTE_LENGTH, SCHEMA_ID_BYTE_LENGTH); idx++; } return serialized; } }
DerefMapSerializationUtil { byte[] serializeFields(Collection<SchemaId> fields) { final byte[] serialized = new byte[SCHEMA_ID_BYTE_LENGTH * fields.size()]; final Iterator<SchemaId> iterator = fields.iterator(); int idx = 0; while (iterator.hasNext()) { final byte[] bytes = iterator.next().getBytes(); assert SCHEMA_ID_BYTE_LENGTH == bytes.length; System.arraycopy(bytes, 0, serialized, idx * SCHEMA_ID_BYTE_LENGTH, SCHEMA_ID_BYTE_LENGTH); idx++; } return serialized; } DerefMapSerializationUtil(IdGenerator idGenerator); }
DerefMapSerializationUtil { byte[] serializeFields(Collection<SchemaId> fields) { final byte[] serialized = new byte[SCHEMA_ID_BYTE_LENGTH * fields.size()]; final Iterator<SchemaId> iterator = fields.iterator(); int idx = 0; while (iterator.hasNext()) { final byte[] bytes = iterator.next().getBytes(); assert SCHEMA_ID_BYTE_LENGTH == bytes.length; System.arraycopy(bytes, 0, serialized, idx * SCHEMA_ID_BYTE_LENGTH, SCHEMA_ID_BYTE_LENGTH); idx++; } return serialized; } DerefMapSerializationUtil(IdGenerator idGenerator); Set<SchemaId> deserializeFields(byte[] serialized, int offset, int length); }
DerefMapSerializationUtil { byte[] serializeFields(Collection<SchemaId> fields) { final byte[] serialized = new byte[SCHEMA_ID_BYTE_LENGTH * fields.size()]; final Iterator<SchemaId> iterator = fields.iterator(); int idx = 0; while (iterator.hasNext()) { final byte[] bytes = iterator.next().getBytes(); assert SCHEMA_ID_BYTE_LENGTH == bytes.length; System.arraycopy(bytes, 0, serialized, idx * SCHEMA_ID_BYTE_LENGTH, SCHEMA_ID_BYTE_LENGTH); idx++; } return serialized; } DerefMapSerializationUtil(IdGenerator idGenerator); Set<SchemaId> deserializeFields(byte[] serialized, int offset, int length);  }