public abstract class AbstractMemcacheObjectEncoder<M extends MemcacheMessage>
extends io.netty.handler.codec.MessageToMessageEncoder<java.lang.Object>
A general purpose AbstractMemcacheObjectEncoder
that encodes MemcacheMessage
s.
Note that this class is designed to be extended, especially because both the binary and ascii protocol require different treatment of their messages. Since the content chunk writing is the same for both, the encoder abstracts this right away.
Constructor and Description |
---|
AbstractMemcacheObjectEncoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptOutboundMessage(java.lang.Object msg) |
protected void |
encode(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Object msg,
java.util.List<java.lang.Object> out) |
protected abstract io.netty.buffer.ByteBuf |
encodeMessage(io.netty.channel.ChannelHandlerContext ctx,
M msg)
Take the given
MemcacheMessage and encode it into a writable ByteBuf . |
bind, close, connect, deregister, disconnect, flush, read
exceptionCaught, handlerAdded, handlerRemoved, isSharable
protected void encode(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
encode
in class io.netty.handler.codec.MessageToMessageEncoder<java.lang.Object>
java.lang.Exception
public boolean acceptOutboundMessage(java.lang.Object msg) throws java.lang.Exception
acceptOutboundMessage
in class io.netty.handler.codec.MessageToMessageEncoder<java.lang.Object>
java.lang.Exception
protected abstract io.netty.buffer.ByteBuf encodeMessage(io.netty.channel.ChannelHandlerContext ctx, M msg)
Take the given MemcacheMessage
and encode it into a writable ByteBuf
.
ctx
- the channel handler context.msg
- the message to encode.ByteBuf
representation of the message.