java.lang.Object
org.minidns.dnsmessage.Question

public class Questionextends Object
A DNS question (request).
  • Field Details

    • name

      public final DnsName name
      The question string (e.g. "measite.de").
    • type

      public final Record.TYPE type
      The question type (e.g. A).
    • clazz

      public final Record.CLASS clazz
      The question class (usually IN for Internet).
    • unicastQuery

      private final boolean unicastQuery
      UnicastQueries have the highest bit of the CLASS field set to 1.
    • byteArray

      private byte[] byteArray
      Cache for the serialized object.
  • Constructor Details

    • Question

      public Question(CharSequence name, Record.TYPE type, Record.CLASS clazz, boolean unicastQuery)
      Create a dns question for the given name/type/class.
      Parameters:
      name - The name e.g. "measite.de".
      type - The type, e.g. A.
      clazz - The class, usually IN (internet).
      unicastQuery - True if this is a unicast query.
    • Question

      public Question(DnsName name, Record.TYPE type, Record.CLASS clazz, boolean unicastQuery)
      Create a question from its components.
      Parameters:
      name - the DNS name
      type - the record type
      clazz - the class, usually IN (internet); must not be null
      unicastQuery - true for unicast query
    • Question

      public Question(DnsName name, Record.TYPE type, Record.CLASS clazz)
      Create a dns question for the given name/type/class.
      Parameters:
      name - The name e.g. "measite.de".
      type - The type, e.g. A.
      clazz - The class, usually IN (internet).
    • Question

      public Question(DnsName name, Record.TYPE type)
      Create a dns question for the given name/type/IN (internet class).
      Parameters:
      name - The name e.g. "measite.de".
      type - The type, e.g. A.
    • Question

      public Question(CharSequence name, Record.TYPE type, Record.CLASS clazz)
      Create a dns question for the given name/type/class.
      Parameters:
      name - The name e.g. "measite.de".
      type - The type, e.g. A.
      clazz - The class, usually IN (internet).
    • Question

      public Question(CharSequence name, Record.TYPE type)
      Create a dns question for the given name/type/IN (internet class).
      Parameters:
      name - The name e.g. "measite.de".
      type - The type, e.g. A.
    • Question

      public Question(DataInputStream dis, byte[] data) throws IOException
      Parse a byte array and rebuild the dns question from it.
      Parameters:
      dis - The input stream.
      data - The plain data (for dns name references).
      Throws:
      IOException - On errors (read outside of packet).
  • Method Details

    • toByteArray

      public byte[] toByteArray()
      Generate a binary packet for this dns question.
      Returns:
      The dns question.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asMessageBuilder

      public DnsMessage.Builder asMessageBuilder()
      Wrap this question in a DnsMessage builder.
      Returns:
      a new DnsMessage builder with this question set
    • asQueryMessage

      public DnsMessage asQueryMessage()
      Build a standalone query message holding this question.
      Returns:
      a new DnsMessage with this question set