Package io.grpc

Class DecompressorRegistry

  • @ExperimentalApi("")
    public final class DecompressorRegistry
    extends java.lang.Object
    Encloses classes related to the compression and decompression of messages.
    • Method Detail

      • with

        public DecompressorRegistry with​(Decompressor d,
                                         boolean advertised)
        Registers a decompressor for both decompression and message encoding negotiation. Returns a new registry.
        d - The decompressor to register
        advertised - If true, the message encoding will be listed in the Accept-Encoding header.
      • getKnownMessageEncodings

        public java.util.Set<java.lang.String> getKnownMessageEncodings()
        Provides a list of all message encodings that have decompressors available.
      • getAdvertisedMessageEncodings

        public java.util.Set<java.lang.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

        public Decompressor lookupDecompressor​(java.lang.String messageEncoding)
        Returns a decompressor for the given message encoding, or null if 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.