public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMessage> extends AbstractMemcacheObjectDecoder
Decoder for both BinaryMemcacheRequest
and BinaryMemcacheResponse
.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_CHUNK_SIZE |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBinaryMemcacheDecoder()
Create a new
AbstractBinaryMemcacheDecoder with default settings. |
protected |
AbstractBinaryMemcacheDecoder(int chunkSize)
Create a new
AbstractBinaryMemcacheDecoder with custom settings. |
Modifier and Type | Method and Description |
---|---|
protected abstract M |
buildInvalidMessage()
Helper method to create a upstream message when the incoming parsing did fail.
|
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx)
When the channel goes inactive, release all frames to prevent data leaks.
|
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
java.util.List<java.lang.Object> out) |
protected abstract M |
decodeHeader(io.netty.buffer.ByteBuf in)
Decode and return the parsed
BinaryMemcacheMessage . |
protected void |
resetDecoder()
Prepare for next decoding iteration.
|
actualReadableBytes, callDecode, channelRead, channelReadComplete, decodeLast, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setSingleDecode
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
public static final int DEFAULT_MAX_CHUNK_SIZE
protected AbstractBinaryMemcacheDecoder()
Create a new AbstractBinaryMemcacheDecoder
with default settings.
protected AbstractBinaryMemcacheDecoder(int chunkSize)
Create a new AbstractBinaryMemcacheDecoder
with custom settings.
chunkSize
- the maximum chunk size of the payload.protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
decode
in class io.netty.handler.codec.ByteToMessageDecoder
java.lang.Exception
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception
When the channel goes inactive, release all frames to prevent data leaks.
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.handler.codec.ByteToMessageDecoder
ctx
- handler contextjava.lang.Exception
protected void resetDecoder()
Prepare for next decoding iteration.
protected abstract M decodeHeader(io.netty.buffer.ByteBuf in)
Decode and return the parsed BinaryMemcacheMessage
.
in
- the incoming buffer.protected abstract M buildInvalidMessage()
Helper method to create a upstream message when the incoming parsing did fail.