public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMessage<H>,H extends BinaryMemcacheMessageHeader> extends AbstractMemcacheObjectDecoder
BinaryMemcacheRequest and BinaryMemcacheResponse.
The difference in the protocols (header) is implemented by the subclasses.ChannelHandler.Sharable, ChannelHandler.Skip| 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 |
buildMessage(H header,
ByteBuf extras,
String key)
Build the complete message, based on the information decoded.
|
void |
channelInactive(ChannelHandlerContext ctx)
When the channel goes inactive, release all frames to prevent data leaks.
|
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
List<Object> out)
Decode the from one
ByteBuf to an other. |
protected abstract H |
decodeHeader(ByteBuf in)
Decode and return the parsed
BinaryMemcacheMessageHeader. |
protected void |
resetDecoder()
Prepare for next decoding iteration.
|
actualReadableBytes, callDecode, channelRead, channelReadComplete, decodeLast, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setSingleDecodebind, channelActive, channelRegistered, channelWritabilityChanged, close, connect, disconnect, exceptionCaught, flush, handlerAdded, isSharable, read, userEventTriggered, writepublic static final int DEFAULT_MAX_CHUNK_SIZE
protected AbstractBinaryMemcacheDecoder()
AbstractBinaryMemcacheDecoder with default settings.protected AbstractBinaryMemcacheDecoder(int chunkSize)
AbstractBinaryMemcacheDecoder with custom settings.chunkSize - the maximum chunk size of the payload.protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
ByteToMessageDecoderByteBuf to an other. This method will be called till either the input
ByteBuf has nothing to read anymore, till nothing was read from the input ByteBuf or till
this method returns null.decode in class ByteToMessageDecoderctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataout - the List to which decoded messages should be addedException - is thrown if an error accourpublic void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive in interface ChannelHandlerchannelInactive in class ByteToMessageDecoderctx - handler contextExceptionprotected void resetDecoder()
protected abstract H decodeHeader(ByteBuf in)
BinaryMemcacheMessageHeader.in - the incoming buffer.Copyright © 2008–2013 The Netty Project. All rights reserved.