Metadata { @Internal public byte[][] serialize() { byte[][] serialized = new byte[storeCount * 2][]; int i = 0; for (Map.Entry<String, List<MetadataEntry>> storeEntry : store.entrySet()) { for (MetadataEntry metadataEntry : storeEntry.getValue()) { serialized[i++] = metadataEntry.key != null ? metadataEntry.key.asciiName() : storeEntry.getKey().getBytes(US_ASCII); serialized[i++] = metadataEntry.getSerialized(); } } return serialized; } @Internal  Metadata(byte[]... binaryValues);  Metadata(); @Internal int headerCount(); boolean containsKey(Key<?> key); T get(Key<T> key); Iterable<T> getAll(final Key<T> key); Set<String> keys(); void put(Key<T> key, T value); boolean remove(Key<T> key, T value); Iterable<T> removeAll(final Key<T> key); @Internal byte[][] serialize(); void merge(Metadata other); void merge(Metadata other, Set<Key<?>> keys); @Override String toString(); static final String BINARY_HEADER_SUFFIX; static final BinaryMarshaller<byte[]> BINARY_BYTE_MARSHALLER; static final AsciiMarshaller<String> ASCII_STRING_MARSHALLER; }
@Test public void testSerializeRaw() { Metadata raw = new Metadata(KEY.asciiName(), LANCE_BYTES); byte[][] serialized = raw.serialize(); assertArrayEquals(serialized[0], KEY.asciiName()); assertArrayEquals(serialized[1], LANCE_BYTES); }