Package io.grpc

Class Codec.Identity

java.lang.Object
io.grpc.Codec.Identity
All Implemented Interfaces:
Codec, Compressor, Decompressor
Enclosing interface:
Codec

public static final class Codec.Identity extends Object implements Codec
The "identity", or "none" codec. This codec is special in that it can be used to explicitly disable Call compression on a Channel that by default compresses.
  • Field Details

    • NONE

      public static final Codec NONE
      Special sentinel codec indicating that no compression should be used. Users should use reference equality to see if compression is disabled.
  • Method Details

    • decompress

      public InputStream decompress(InputStream is)
      Description copied from interface: Decompressor
      Wraps an existing input stream with a decompressing input stream.
      Specified by:
      decompress in interface Decompressor
      Parameters:
      is - The input stream of uncompressed data
      Returns:
      An input stream that decompresses
    • getMessageEncoding

      public String getMessageEncoding()
      Description copied from interface: Compressor
      Returns the message encoding that this compressor uses.

      This can be values such as "gzip", "deflate", "snappy", etc.

      Specified by:
      getMessageEncoding in interface Compressor
      Specified by:
      getMessageEncoding in interface Decompressor
    • compress

      public OutputStream compress(OutputStream os)
      Description copied from interface: Compressor
      Wraps an existing output stream with a compressing output stream.
      Specified by:
      compress in interface Compressor
      Parameters:
      os - The output stream of uncompressed data
      Returns:
      An output stream that compresses