Top Description Fields Constructors Methods
io.netty.handler.codec.dns

public Class DatagramDnsResponseEncoder

extends MessageToMessageEncoder<AddressedEnvelope<DnsResponse, InetSocketAddress>>
Class Inheritance
Annotations
@UnstableApi
@Sharable
Imports
io.netty.buffer.ByteBuf, io.netty.channel.AddressedEnvelope, .ChannelHandler, .ChannelHandlerContext, io.netty.channel.socket.DatagramPacket, io.netty.handler.codec.MessageToMessageEncoder, io.netty.util.internal.UnstableApi, java.net.InetSocketAddress, java.util.List

Encodes a DatagramDnsResponse (or an AddressedEnvelope of DnsResponse} into a DatagramPacket.

Field Summary

Modifier and TypeField and Description
private final DnsRecordEncoder

Constructor Summary

AccessConstructor and Description
public
public
DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)

Creates a new encoder with the specified recordEncoder.

Method Summary

Modifier and TypeMethod and Description
protected ByteBuf
allocateBuffer(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse, InetSocketAddress> msg)

Allocate a ByteBuf which will be used for constructing a datagram packet.

protected void
encode(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse, InetSocketAddress>
the message to encode to an other one
in
,
List<Object>
the List into which the encoded msg should be added needs to do some kind of aggregation
out
)

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to an other.
Inherited from io.netty.handler.codec.MessageToMessageEncoder:
acceptOutboundMessagewrite

Field Detail

recordEncoderback to summary
private final DnsRecordEncoder recordEncoder

Constructor Detail

DatagramDnsResponseEncoderback to summary
public DatagramDnsResponseEncoder()

Creates a new encoder with the default record encoder.

DatagramDnsResponseEncoderback to summary
public DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)

Creates a new encoder with the specified recordEncoder.

Method Detail

allocateBufferback to summary
protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse, InetSocketAddress> msg) throws Exception

Allocate a ByteBuf which will be used for constructing a datagram packet. Sub-classes may override this method to return a ByteBuf with a perfect matching initial capacity.

encodeback to summary
protected void encode(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse, InetSocketAddress> in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

Doc from io.netty.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageEncoder belongs to

in:AddressedEnvelope<DnsResponse, InetSocketAddress>

the message to encode to an other one

out:List<Object>

the List into which the encoded msg should be added needs to do some kind of aggregation

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs