Package io.grpc
Class InternalMetadata
- java.lang.Object
-
- io.grpc.InternalMetadata
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
InternalMetadata.TrustedAsciiMarshaller<T>
A specialized plain ASCII marshaller.
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.io.BaseEncoding
BASE64_ENCODING_OMIT_PADDING
An instance of base64 encoder that omits padding.static java.nio.charset.Charset
US_ASCII
Copy 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 int
headerCount(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 Metadata
newMetadata(byte[]... binaryValues)
static Metadata
newMetadata(int usedNames, byte[]... binaryValues)
static Metadata
newMetadataWithParsedValues(int usedNames, java.lang.Object[] namesAndValues)
Creates a newMetadata
instance from serialized data, with some values pre-parsed.static <T> java.lang.Object
parsedValue(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 asInputStream
s.
-
-
-
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 asInputStream
s.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 orInputStream
s.
-
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.BinaryStreamMarshaller
associated 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 newMetadata
instance 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.
-
-