@UnstableApi public final class TcpDnsResponseDecoder extends LengthFieldBasedFrameDecoder
ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| Constructor and Description |
|---|
TcpDnsResponseDecoder()
Creates a new decoder with the default record decoder.
|
TcpDnsResponseDecoder(DnsRecordDecoder recordDecoder,
int maxFrameLength)
Creates a new decoder with the specified
recordDecoder and maxFrameLength |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
decode(ChannelHandlerContext ctx,
ByteBuf in)
Create a frame out of the
ByteBuf and return it. |
protected ByteBuf |
extractFrame(ChannelHandlerContext ctx,
ByteBuf buffer,
int index,
int length)
Extract the sub-region of the specified buffer.
|
decode, getUnadjustedFrameLengthactualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedpublic TcpDnsResponseDecoder()
public TcpDnsResponseDecoder(DnsRecordDecoder recordDecoder, int maxFrameLength)
recordDecoder and maxFrameLengthprotected java.lang.Object decode(ChannelHandlerContext ctx, ByteBuf in) throws java.lang.Exception
LengthFieldBasedFrameDecoderByteBuf and return it.decode in class LengthFieldBasedFrameDecoderctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataByteBuf which represent the frame or null if no frame could
be created.java.lang.Exceptionprotected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length)
LengthFieldBasedFrameDecoder
If you are sure that the frame and its content are not accessed after
the current LengthFieldBasedFrameDecoder.decode(ChannelHandlerContext, ByteBuf)
call returns, you can even avoid memory copy by returning the sliced
sub-region (i.e. return buffer.slice(index, length)).
It's often useful when you convert the extracted frame into an object.
Refer to the source code of ObjectDecoder to see how this method
is overridden to avoid memory copy.
extractFrame in class LengthFieldBasedFrameDecoderCopyright © 2008–2019 The Netty Project. All rights reserved.