public abstract class AbstractMemcacheObjectEncoder<M extends MemcacheMessage> extends MessageToMessageEncoder<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.
ChannelHandler.Sharable
Constructor and Description |
---|
AbstractMemcacheObjectEncoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptOutboundMessage(Object msg) |
protected void |
encode(ChannelHandlerContext ctx,
Object msg,
List<Object> out) |
protected abstract ByteBuf |
encodeMessage(ChannelHandlerContext ctx,
M msg)
Take the given
MemcacheMessage and encode it into a writable ByteBuf . |
write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception
encode
in class MessageToMessageEncoder<Object>
Exception
public boolean acceptOutboundMessage(Object msg) throws Exception
acceptOutboundMessage
in class MessageToMessageEncoder<Object>
Exception
protected abstract ByteBuf encodeMessage(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.Copyright © 2017 Couchbase, Inc.. All rights reserved.