Class BufferCompressor

java.lang.Object
org.apache.flink.runtime.io.network.buffer.BufferCompressor

public class BufferCompressor extends Object
Compressor for Buffer.
  • Constructor Details

    • BufferCompressor

      public BufferCompressor(int bufferSize, org.apache.flink.configuration.NettyShuffleEnvironmentOptions.CompressionCodec factoryName)
  • Method Details

    • compressToIntermediateBuffer

      public Buffer compressToIntermediateBuffer(Buffer buffer)
      Compresses the given Buffer using BlockCompressor. The compressed data will be stored in the intermediate buffer of this BufferCompressor and returned to the caller. The caller must guarantee that the returned Buffer has been freed when calling the method next time.

      Notes that the compression will always start from offset 0 to the size of the input Buffer.

    • compressToOriginalBuffer

      public Buffer compressToOriginalBuffer(Buffer buffer)
      The difference between this method and compressToIntermediateBuffer(Buffer) is that this method will copy the compressed data back to the input Buffer starting from offset 0.

      The caller must guarantee that the input Buffer is writable.