接口 CompressionCodec

所有已知实现类:
CompressionCodecLZ4, CompressionCodecNone, CompressionCodecSnappy, CompressionCodecZLib, CompressionCodecZstd

public interface CompressionCodec
Generic compression codec interface.
  • 方法概要

    修饰符和类型
    方法
    说明
    io.netty.buffer.ByteBuf
    decode(io.netty.buffer.ByteBuf encoded, int uncompressedSize)
    Decompress a buffer.
    io.netty.buffer.ByteBuf
    encode(io.netty.buffer.ByteBuf raw)
    Compress a buffer.
  • 方法详细资料

    • encode

      io.netty.buffer.ByteBuf encode(io.netty.buffer.ByteBuf raw)
      Compress a buffer.
      参数:
      raw - a buffer with the uncompressed content. The reader/writer indexes will not be modified
      返回:
      a new buffer with the compressed content. The buffer needs to be released by the receiver
    • decode

      io.netty.buffer.ByteBuf decode(io.netty.buffer.ByteBuf encoded, int uncompressedSize) throws IOException
      Decompress a buffer.

      The buffer needs to have been compressed with the matching Encoder.

      参数:
      encoded - the compressed content
      uncompressedSize - the size of the original content
      返回:
      a ByteBuf with the compressed content. The buffer needs to be released by the receiver
      抛出:
      IOException - if the decompression fails