Package io.grpc
Class InternalMetadata
- java.lang.Object
-
- io.grpc.InternalMetadata
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceInternalMetadata.TrustedAsciiMarshaller<T>A specialized plain ASCII marshaller.
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.io.BaseEncodingBASE64_ENCODING_OMIT_PADDINGAn instance of base64 encoder that omits padding.static java.nio.charset.CharsetUS_ASCIICopy of StandardCharsets, which is only available on Java 1.7 and above.
-
Constructor Summary
Constructors Constructor Description InternalMetadata()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intheaderCount(Metadata md)static <T> Metadata.Key<T>keyOf(java.lang.String name, InternalMetadata.TrustedAsciiMarshaller<T> marshaller)static <T> Metadata.Key<T>keyOf(java.lang.String name, Metadata.AsciiMarshaller<T> marshaller)static MetadatanewMetadata(byte[]... binaryValues)static MetadatanewMetadata(int usedNames, byte[]... binaryValues)static MetadatanewMetadataWithParsedValues(int usedNames, java.lang.Object[] namesAndValues)Creates a newMetadatainstance from serialized data, with some values pre-parsed.static <T> java.lang.ObjectparsedValue(Metadata.BinaryStreamMarshaller<T> marshaller, T value)Creates a holder for a pre-parsed value read by the transport.static byte[][]serialize(Metadata md)static java.lang.Object[]serializePartial(Metadata md)Serializes all metadata entries, leaving some values asInputStreams.
-
-
-
Field Detail
-
US_ASCII
@Internal public static final java.nio.charset.Charset US_ASCII
Copy of StandardCharsets, which is only available on Java 1.7 and above.
-
BASE64_ENCODING_OMIT_PADDING
@Internal public static final com.google.common.io.BaseEncoding BASE64_ENCODING_OMIT_PADDING
An instance of base64 encoder that omits padding.
-
-
Method Detail
-
keyOf
@Internal public static <T> Metadata.Key<T> keyOf(java.lang.String name, InternalMetadata.TrustedAsciiMarshaller<T> marshaller)
-
keyOf
@Internal public static <T> Metadata.Key<T> keyOf(java.lang.String name, Metadata.AsciiMarshaller<T> marshaller)
-
serializePartial
@Internal public static java.lang.Object[] serializePartial(Metadata md)
Serializes all metadata entries, leaving some values asInputStreams.Produces serialized names and values interleaved. result[i*2] are names, while result[i*2+1] are values.
Names are byte arrays as described according to the
Metadata.serialize()method. Values are either byte arrays orInputStreams.
-
parsedValue
@Internal public static <T> java.lang.Object parsedValue(Metadata.BinaryStreamMarshaller<T> marshaller, T value)
Creates a holder for a pre-parsed value read by the transport.- Parameters:
marshaller- TheMetadata#BinaryStreamMarshallerassociated with this value.value- The value to store.- Returns:
- an object holding the pre-parsed value for this key.
-
newMetadataWithParsedValues
@Internal public static Metadata newMetadataWithParsedValues(int usedNames, java.lang.Object[] namesAndValues)
Creates a newMetadatainstance from serialized data, with some values pre-parsed. Metadata will mutate the passed in array.- Parameters:
usedNames- The number of names used.namesAndValues- An array of interleaved names and values, with each name (at even indices) represented as a byte array, and each value (at odd indices) represented as either a byte array or an object returned by theparsedValue(io.grpc.Metadata.BinaryStreamMarshaller<T>, T)method.
-
-