Class DefaultDnsRecordDecoder

java.lang.Object
io.netty.handler.codec.dns.DefaultDnsRecordDecoder
All Implemented Interfaces:
DnsRecordDecoder

public class DefaultDnsRecordDecoder extends java.lang.Object implements DnsRecordDecoder
The default DnsRecordDecoder implementation.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final java.lang.String
     

    Fields inherited from interface DnsRecordDecoder

    DEFAULT
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    static java.lang.String
    Retrieves a domain name given a buffer containing a DNS packet.
    protected java.lang.String
    Retrieves a domain name given a buffer containing a DNS packet.
    Decodes a DNS question into its object representation.
    final <T extends DnsRecord>
    T
    Decodes a DNS record into its object representation.
    protected DnsRecord
    decodeRecord(java.lang.String name, DnsRecordType type, int dnsClass, long timeToLive, ByteBuf in, int offset, int length)
    Decodes a record from the information decoded so far by decodeRecord(ByteBuf).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DefaultDnsRecordDecoder

      protected DefaultDnsRecordDecoder()
      Creates a new instance.
  • Method Details

    • decodeQuestion

      public final DnsQuestion decodeQuestion(ByteBuf in) throws java.lang.Exception
      Description copied from interface: DnsRecordDecoder
      Decodes a DNS question into its object representation.
      Specified by:
      decodeQuestion in interface DnsRecordDecoder
      Parameters:
      in - the input buffer which contains a DNS question at its reader index
      Throws:
      java.lang.Exception
    • decodeRecord

      public final <T extends DnsRecord> T decodeRecord(ByteBuf in) throws java.lang.Exception
      Description copied from interface: DnsRecordDecoder
      Decodes a DNS record into its object representation.
      Specified by:
      decodeRecord in interface DnsRecordDecoder
      Parameters:
      in - the input buffer which contains a DNS record at its reader index
      Returns:
      the decoded record, or null if there are not enough data in the input buffer
      Throws:
      java.lang.Exception
    • decodeRecord

      protected DnsRecord decodeRecord(java.lang.String name, DnsRecordType type, int dnsClass, long timeToLive, ByteBuf in, int offset, int length) throws java.lang.Exception
      Decodes a record from the information decoded so far by decodeRecord(ByteBuf).
      Parameters:
      name - the domain name of the record
      type - the type of the record
      dnsClass - the class of the record
      timeToLive - the TTL of the record
      in - the ByteBuf that contains the RDATA
      offset - the start offset of the RDATA in in
      length - the length of the RDATA
      Returns:
      a DnsRawRecord. Override this method to decode RDATA and return other record implementation.
      Throws:
      java.lang.Exception
    • decodeName0

      protected java.lang.String decodeName0(ByteBuf 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 java.lang.String decodeName(ByteBuf 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