Top Description Inners Fields Constructors Methods
io.grpc

public final Class InternalMetadata

extends Object
Class Inheritance
Annotations
@Internal
Imports
com.google.common.io.BaseEncoding, io.grpc.Metadata.AsciiMarshaller, .Metadata.BinaryStreamMarshaller, java.io.InputStream, java.nio.charset.Charset

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 and Inner Type Summary

Modifier and TypeClass and Description
public static interface
InternalMetadata.TrustedAsciiMarshaller<T>

A specialized plain ASCII marshaller.

Field Summary

Modifier and TypeField and Description
public static final BaseEncoding
BASE64_ENCODING_OMIT_PADDING

An instance of base64 encoder that omits padding.

public static final Charset
US_ASCII

Copy of StandardCharsets, which is only available on Java 1.7 and above.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
public static <T> Metadata.Key<T>
public static <T> Metadata.Key<T>
keyOf(String name, Metadata.AsciiMarshaller<T> marshaller)

public static Metadata
newMetadata(byte[]... binaryValues)

public static Metadata
newMetadata(int usedNames, byte[]... binaryValues)

public static Metadata
newMetadataWithParsedValues(int
The number of names used.
usedNames
,
Object[]
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 method.
namesAndValues
)

Creates a new Metadata instance from serialized data, with some values pre-parsed.

public static <T> Object

Returns:

an object holding the pre-parsed value for this key.
parsedValue
(Metadata.BinaryStreamMarshaller<T>
The Metadata.BinaryStreamMarshaller associated with this value.
marshaller
,
T
The value to store.
value
)

Creates a holder for a pre-parsed value read by the transport.

public static byte[][]
public static Object[]
serializePartial(Metadata md)

Serializes all metadata entries, leaving some values as InputStreams.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASE64_ENCODING_OMIT_PADDINGback to summary
public static final BaseEncoding BASE64_ENCODING_OMIT_PADDING

An instance of base64 encoder that omits padding.

Annotations
@Internal
US_ASCIIback to summary
public static final Charset US_ASCII

Copy of StandardCharsets, which is only available on Java 1.7 and above.

Annotations
@Internal

Constructor Detail

InternalMetadataback to summary
public InternalMetadata()

Method Detail

headerCountback to summary
public static int headerCount(Metadata md)
Annotations
@Internal
keyOfback to summary
public static <T> Metadata.Key<T> keyOf(String name, InternalMetadata.TrustedAsciiMarshaller<T> marshaller)
Annotations
@Internal
keyOfback to summary
public static <T> Metadata.Key<T> keyOf(String name, Metadata.AsciiMarshaller<T> marshaller)
Annotations
@Internal
newMetadataback to summary
public static Metadata newMetadata(byte[]... binaryValues)
Annotations
@Internal
newMetadataback to summary
public static Metadata newMetadata(int usedNames, byte[]... binaryValues)
Annotations
@Internal
newMetadataWithParsedValuesback to summary
public static Metadata newMetadataWithParsedValues(int usedNames, Object[] namesAndValues)

Creates a new Metadata instance from serialized data, with some values pre-parsed. Metadata will mutate the passed in array.

Parameters
usedNames:int

The number of names used.

namesAndValues:Object[]

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 method.

Annotations
@Internal
parsedValueback to summary
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:Metadata.BinaryStreamMarshaller<T>

The Metadata.BinaryStreamMarshaller associated with this value.

value:T

The value to store.

Returns:Object

an object holding the pre-parsed value for this key.

Annotations
@Internal
serializeback to summary
public static byte[][] serialize(Metadata md)
Annotations
@Internal
serializePartialback to summary
public static 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.

Annotations
@Internal
io.grpc back to summary

public Interface InternalMetadata.TrustedAsciiMarshaller<T>

extends Metadata.TrustedAsciiMarshaller<T>
Annotations
@Internal

A specialized plain ASCII marshaller. Both input and output are assumed to be valid header ASCII.

Extended here to break the dependency.

Method Summary

Inherited from io.grpc.Metadata.TrustedAsciiMarshaller:
parseAsciiStringtoAsciiString