public class MXextends Data
DNS MX (Mail Exchange) record payload.
Specifies mail servers responsible for accepting email messages on behalf of a domain.
  • Field Details

    • priority

      public final int priority
      The priority of this service. Lower values mean higher priority.
    • target

      public final DnsName target
      The name of the target server.
  • Constructor Details

    • MX

      public MX(int priority, String name)
      Builds a record from a preference and a textual exchanger name.
      Parameters:
      priority - the MX preference, lower values being tried first
      name - the mail exchanger, converted from presentation form
    • MX

      public MX(int priority, DnsName name)
      Builds a record from a preference and an exchanger name.
      Parameters:
      priority - the MX preference, lower values being tried first
      name - the mail exchanger that receives the mail
  • Method Details

    • parse

      public static MX parse(DataInputStream dis, byte[] data) throws IOException
      Parse an MX record from a stream.
      Parameters:
      dis - the input stream
      data - the raw DNS message data
      Returns:
      the parsed MX record
      Throws:
      IOException - on parse error
    • serialize

      public void serialize(DataOutputStream dos) throws IOException
      Writes the preference and exchanger name to the stream.
      Specified by:
      serialize in class Data
      Parameters:
      dos - the output stream to serialize to.
      Throws:
      IOException - if an I/O error occurs.
    • toString

      public String toString()
      Renders the preference and exchanger as presentation text.
      Overrides:
      toString in class Object
    • getType

      public Record.TYPE getType()
      Reports the MX record type.
      Specified by:
      getType in class Data
      Returns:
      The DNS record type of this payload.