Package io.netty.handler.codec.dns
Class DatagramDnsResponseEncoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageEncoder<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>>
-
- io.netty.handler.codec.dns.DatagramDnsResponseEncoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelOutboundHandler
@Sharable public class DatagramDnsResponseEncoder extends io.netty.handler.codec.MessageToMessageEncoder<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>>
-
-
Constructor Summary
Constructors Constructor Description DatagramDnsResponseEncoder()Creates a new encoder with the default record encoder.DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)Creates a new encoder with the specifiedrecordEncoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.netty.buffer.ByteBufallocateBuffer(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress> msg)Allocate aByteBufwhich will be used for constructing a datagram packet.protected voidencode(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress> in, List<Object> out)-
Methods inherited from class io.netty.handler.codec.MessageToMessageEncoder
acceptOutboundMessage, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
DatagramDnsResponseEncoder
public DatagramDnsResponseEncoder()
Creates a new encoder with the default record encoder.
-
DatagramDnsResponseEncoder
public DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specifiedrecordEncoder.
-
-
Method Detail
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress> in, List<Object> out) throws Exception- Specified by:
encodein classio.netty.handler.codec.MessageToMessageEncoder<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>>- Throws:
Exception
-
allocateBuffer
protected io.netty.buffer.ByteBuf allocateBuffer(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress> msg) throws ExceptionAllocate aByteBufwhich will be used for constructing a datagram packet. Sub-classes may override this method to return aByteBufwith a perfect matching initial capacity.- Throws:
Exception
-
-