@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); }
@Nullable byte[][] serialize() { if (len() == cap()) { return namesAndValues; } byte[][] serialized = new byte[len()][]; System.arraycopy(namesAndValues, 0, serialized, 0, len()); return serialized; }
Metadata { @Nullable byte[][] serialize() { if (len() == cap()) { return namesAndValues; } byte[][] serialized = new byte[len()][]; System.arraycopy(namesAndValues, 0, serialized, 0, len()); return serialized; } }
Metadata { @Nullable byte[][] serialize() { if (len() == cap()) { return namesAndValues; } byte[][] serialized = new byte[len()][]; System.arraycopy(namesAndValues, 0, serialized, 0, len()); return serialized; } Metadata(byte[]... binaryValues);   Metadata(int usedNames, byte[]... binaryValues);  Metadata(); }
Metadata { @Nullable byte[][] serialize() { if (len() == cap()) { return namesAndValues; } byte[][] serialized = new byte[len()][]; System.arraycopy(namesAndValues, 0, serialized, 0, len()); return serialized; } Metadata(byte[]... binaryValues);   Metadata(int usedNames, byte[]... binaryValues);  Metadata(); boolean containsKey(Key<?> key); @Nullable T get(Key<T> key); @Nullable Iterable<T> getAll(final Key<T> key); @SuppressWarnings("deprecation") // The String ctor is deprecated, but fast. Set<String> keys(); void put(Key<T> key, T value); boolean remove(Key<T> key, T value); Iterable<T> removeAll(Key<T> key); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4691") void discardAll(Key<T> key); void merge(Metadata other); void merge(Metadata other, Set<Key<?>> keys); @SuppressWarnings("BetaApi") // BaseEncoding is stable in Guava 20.0 @Override String toString(); }
Metadata { @Nullable byte[][] serialize() { if (len() == cap()) { return namesAndValues; } byte[][] serialized = new byte[len()][]; System.arraycopy(namesAndValues, 0, serialized, 0, len()); return serialized; } Metadata(byte[]... binaryValues);   Metadata(int usedNames, byte[]... binaryValues);  Metadata(); boolean containsKey(Key<?> key); @Nullable T get(Key<T> key); @Nullable Iterable<T> getAll(final Key<T> key); @SuppressWarnings("deprecation") // The String ctor is deprecated, but fast. Set<String> keys(); void put(Key<T> key, T value); boolean remove(Key<T> key, T value); Iterable<T> removeAll(Key<T> key); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4691") void discardAll(Key<T> key); void merge(Metadata other); void merge(Metadata other, Set<Key<?>> keys); @SuppressWarnings("BetaApi") // BaseEncoding is stable in Guava 20.0 @Override String toString(); static final String BINARY_HEADER_SUFFIX; static final BinaryMarshaller<byte[]> BINARY_BYTE_MARSHALLER; static final AsciiMarshaller<String> ASCII_STRING_MARSHALLER; }