Interface CompressionCodec

All Known Implementing Classes:
CompressionCodecLZ4, CompressionCodecNone, CompressionCodecSnappy, CompressionCodecZLib, CompressionCodecZstd

public interface CompressionCodec
Generic compression codec interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
  • Method Details

    • encode

      io.netty.buffer.ByteBuf encode(io.netty.buffer.ByteBuf raw)
      Compress a buffer.
      Parameters:
      raw - a buffer with the uncompressed content. The reader/writer indexes will not be modified
      Returns:
      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.

      Parameters:
      encoded - the compressed content
      uncompressedSize - the size of the original content
      Returns:
      a ByteBuf with the compressed content. The buffer needs to be released by the receiver
      Throws:
      IOException - if the decompression fails