Package io.grpc

Class InternalMetadata


  • @Internal
    public final class InternalMetadata
    extends java.lang.Object
    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.
    • 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.
    • Constructor Detail

      • InternalMetadata

        public InternalMetadata()
    • Method Detail

      • newMetadata

        @Internal
        public static Metadata newMetadata​(byte[]... binaryValues)
      • newMetadata

        @Internal
        public static Metadata newMetadata​(int usedNames,
                                           byte[]... binaryValues)
      • serializePartial

        @Internal
        public static java.lang.Object[] serializePartial​(Metadata md)
        Serializes all metadata entries, leaving some values as InputStreams.

        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 or InputStreams.

      • 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 - The Metadata.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 new Metadata 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 the parsedValue(io.grpc.Metadata.BinaryStreamMarshaller<T>, T) method.