- java.lang.Object
-
- io.netty5.handler.codec.dns.DefaultDnsRecordDecoder
-
- All Implemented Interfaces:
DnsRecordDecoder
@UnstableApi public class DefaultDnsRecordDecoder extends Object implements DnsRecordDecoder
The defaultDnsRecordDecoderimplementation.- See Also:
DefaultDnsRecordEncoder
-
-
Field Summary
-
Fields inherited from interface io.netty5.handler.codec.dns.DnsRecordDecoder
DEFAULT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultDnsRecordDecoder()Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringdecodeName(Buffer in)Retrieves a domain name given a buffer containing a DNS packet.protected StringdecodeName0(Buffer in)Retrieves a domain name given a buffer containing a DNS packet.DnsQuestiondecodeQuestion(Buffer in)Decodes a DNS question into its object representation.<T extends DnsRecord>
TdecodeRecord(BufferAllocator allocator, Buffer in)Decodes a DNS record into its object representation.protected DnsRecorddecodeRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, BufferAllocator allocator, Buffer in, int offset, int length)Decodes a record from the information decoded so far byDnsRecordDecoder.decodeRecord(BufferAllocator, Buffer).
-
-
-
Method Detail
-
decodeQuestion
public final DnsQuestion decodeQuestion(Buffer in) throws Exception
Description copied from interface:DnsRecordDecoderDecodes a DNS question into its object representation.- Specified by:
decodeQuestionin interfaceDnsRecordDecoder- Parameters:
in- the input buffer which contains a DNS question at its reader index- Throws:
Exception
-
decodeRecord
public final <T extends DnsRecord> T decodeRecord(BufferAllocator allocator, Buffer in) throws Exception
Description copied from interface:DnsRecordDecoderDecodes a DNS record into its object representation.- Specified by:
decodeRecordin interfaceDnsRecordDecoderin- the input buffer which contains a DNS record at its reader index- Returns:
- the decoded record, or
nullif there are not enough data in the input buffer - Throws:
Exception
-
decodeRecord
protected DnsRecord decodeRecord(String name, DnsRecordType type, int dnsClass, long timeToLive, BufferAllocator allocator, Buffer in, int offset, int length) throws Exception
Decodes a record from the information decoded so far byDnsRecordDecoder.decodeRecord(BufferAllocator, Buffer).- Parameters:
name- the domain name of the recordtype- the type of the recorddnsClass- the class of the recordtimeToLive- the TTL of the recordin- theBufferthat contains the RDATAoffset- the start offset of the RDATA ininlength- the length of the RDATA- Returns:
- a
DnsRawRecord. Override this method to decode RDATA and return other record implementation. - Throws:
Exception
-
decodeName0
protected String decodeName0(Buffer in)
Retrieves a domain name given a buffer containing a DNS packet. If the name contains a pointer, the position of the buffer will be set to directly after the pointer's index after the name has been read.- Parameters:
in- the byte buffer containing the DNS packet- Returns:
- the domain name for an entry
-
decodeName
public static String decodeName(Buffer in)
Retrieves a domain name given a buffer containing a DNS packet. If the name contains a pointer, the position of the buffer will be set to directly after the pointer's index after the name has been read.- Parameters:
in- the byte buffer containing the DNS packet- Returns:
- the domain name for an entry
-
-