Package io.grpc
Class Codec.Gzip
- java.lang.Object
-
- io.grpc.Codec.Gzip
-
- All Implemented Interfaces:
Codec,Compressor,Decompressor
- Enclosing interface:
- Codec
public static final class Codec.Gzip extends Object implements Codec
A gzip compressor and decompressor. In the future this will likely support other compression methods, such as compression level.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.grpc.Codec
Codec.Gzip, Codec.Identity
-
-
Constructor Summary
Constructors Constructor Description Gzip()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputStreamcompress(OutputStream os)Wraps an existing output stream with a compressing output stream.InputStreamdecompress(InputStream is)Wraps an existing input stream with a decompressing input stream.StringgetMessageEncoding()Returns the message encoding that this compressor uses.
-
-
-
Method Detail
-
getMessageEncoding
public String getMessageEncoding()
Description copied from interface:CompressorReturns the message encoding that this compressor uses.This can be values such as "gzip", "deflate", "snappy", etc.
- Specified by:
getMessageEncodingin interfaceCompressor- Specified by:
getMessageEncodingin interfaceDecompressor
-
compress
public OutputStream compress(OutputStream os) throws IOException
Description copied from interface:CompressorWraps an existing output stream with a compressing output stream.- Specified by:
compressin interfaceCompressor- Parameters:
os- The output stream of uncompressed data- Returns:
- An output stream that compresses
- Throws:
IOException
-
decompress
public InputStream decompress(InputStream is) throws IOException
Description copied from interface:DecompressorWraps an existing input stream with a decompressing input stream.- Specified by:
decompressin interfaceDecompressor- Parameters:
is- The input stream of uncompressed data- Returns:
- An input stream that decompresses
- Throws:
IOException
-
-