Class DecompressorRegistry
java.lang.Object
io.grpc.DecompressorRegistry
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
@ThreadSafe
public final class DecompressorRegistry
extends Object
Encloses classes related to the compression and decompression of messages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classInformation about a decompressor. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final com.google.common.base.Joinerprivate final byte[]private final Map<String, DecompressorRegistry.DecompressorInfo> private static final DecompressorRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateDecompressorRegistry(Decompressor d, boolean advertised, DecompressorRegistry parent) -
Method Summary
Modifier and TypeMethodDescriptionstatic DecompressorRegistryProvides a list of all message encodings that have decompressors available and should be advertised.static DecompressorRegistryProvides a list of all message encodings that have decompressors available.(package private) byte[]lookupDecompressor(String messageEncoding) Returns a decompressor for the given message encoding, ornullif none has been registered.with(Decompressor d, boolean advertised) Registers a decompressor for both decompression and message encoding negotiation.
-
Field Details
-
ACCEPT_ENCODING_JOINER
static final com.google.common.base.Joiner ACCEPT_ENCODING_JOINER -
DEFAULT_INSTANCE
-
decompressors
-
advertisedDecompressors
private final byte[] advertisedDecompressors
-
-
Constructor Details
-
DecompressorRegistry
-
DecompressorRegistry
private DecompressorRegistry()
-
-
Method Details
-
emptyInstance
-
getDefaultInstance
-
with
Registers a decompressor for both decompression and message encoding negotiation. Returns a new registry.- Parameters:
d- The decompressor to registeradvertised- If true, the message encoding will be listed in the Accept-Encoding header.
-
getKnownMessageEncodings
-
getRawAdvertisedMessageEncodings
byte[] getRawAdvertisedMessageEncodings() -
getAdvertisedMessageEncodings
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704") public Set<String> getAdvertisedMessageEncodings()Provides a list of all message encodings that have decompressors available and should be advertised.The specification doesn't say anything about ordering, or preference, so the returned codes can be arbitrary.
-
lookupDecompressor
Returns a decompressor for the given message encoding, ornullif none has been registered.This ignores whether the compressor is advertised. According to the spec, if we know how to process this encoding, we attempt to, regardless of whether or not it is part of the encodings sent to the remote host.
-