Class AbstractBinaryMemcacheEncoder<M extends BinaryMemcacheMessage>

All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler
Direct Known Subclasses:
BinaryMemcacheRequestEncoder, BinaryMemcacheResponseEncoder

@UnstableApi public abstract class AbstractBinaryMemcacheEncoder<M extends BinaryMemcacheMessage> extends AbstractMemcacheObjectEncoder<M>
A MessageToByteEncoder that encodes binary memcache messages into bytes.
  • Field Details

    • MINIMUM_HEADER_SIZE

      private static final int MINIMUM_HEADER_SIZE
      Every binary memcache message has at least a 24 bytes header.
      See Also:
  • Constructor Details

    • AbstractBinaryMemcacheEncoder

      public AbstractBinaryMemcacheEncoder()
  • Method Details

    • encodeMessage

      protected ByteBuf encodeMessage(ChannelHandlerContext ctx, M msg)
      Description copied from class: AbstractMemcacheObjectEncoder
      Take the given MemcacheMessage and encode it into a writable ByteBuf.
      Specified by:
      encodeMessage in class AbstractMemcacheObjectEncoder<M extends BinaryMemcacheMessage>
      Parameters:
      ctx - the channel handler context.
      msg - the message to encode.
      Returns:
      the ByteBuf representation of the message.
    • encodeExtras

      private static void encodeExtras(ByteBuf buf, ByteBuf extras)
      Encode the extras.
      Parameters:
      buf - the ByteBuf to write into.
      extras - the extras to encode.
    • encodeKey

      private static void encodeKey(ByteBuf buf, ByteBuf key)
      Encode the key.
      Parameters:
      buf - the ByteBuf to write into.
      key - the key to encode.
    • encodeHeader

      protected abstract void encodeHeader(ByteBuf buf, M msg)
      Encode the header.

      This methods needs to be implemented by a sub class because the header is different for both requests and responses.

      Parameters:
      buf - the ByteBuf to write into.
      msg - the message to encode.