Package io.grpc
Class InternalMetadata
java.lang.Object
io.grpc.InternalMetadata
Internal
Metadata accessor. This is intended for use by io.grpc.internal, and the
specifically supported transport packages. If you *really* think you need to use this, contact
the gRPC team first.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA specialized plain ASCII marshaller. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.io.BaseEncodingAn instance of base64 encoder that omits padding.static final CharsetCopy of StandardCharsets, which is only available on Java 1.7 and above. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intheaderCount(Metadata md) static <T> Metadata.Key<T>keyOf(String name, InternalMetadata.TrustedAsciiMarshaller<T> marshaller) static <T> Metadata.Key<T>keyOf(String name, Metadata.AsciiMarshaller<T> marshaller) static MetadatanewMetadata(byte[]... binaryValues) static MetadatanewMetadata(int usedNames, byte[]... binaryValues) static MetadatanewMetadataWithParsedValues(int usedNames, Object[] namesAndValues) Creates a newMetadatainstance from serialized data, with some values pre-parsed.static <T> ObjectparsedValue(Metadata.BinaryStreamMarshaller<T> marshaller, T value) Creates a holder for a pre-parsed value read by the transport.static byte[][]static Object[]Serializes all metadata entries, leaving some values asInputStreams.
-
Field Details
-
US_ASCII
Copy of StandardCharsets, which is only available on Java 1.7 and above. -
BASE64_ENCODING_OMIT_PADDING
An instance of base64 encoder that omits padding.
-
-
Constructor Details
-
InternalMetadata
public InternalMetadata()
-
-
Method Details
-
keyOf
@Internal public static <T> Metadata.Key<T> keyOf(String name, InternalMetadata.TrustedAsciiMarshaller<T> marshaller) -
keyOf
@Internal public static <T> Metadata.Key<T> keyOf(String name, Metadata.AsciiMarshaller<T> marshaller) -
newMetadata
-
newMetadata
-
serialize
-
headerCount
-
serializePartial
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> 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, 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.
-