Class Question


  • public class Question
    extends java.lang.Object
    A DNS question (request).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] byteArray
      Cache for the serialized object.
      private Record.CLASS clazz
      The question class (usually IN / internet).
      private java.lang.String name
      The question string (e.g.
      private Record.TYPE type
      The question type (e.g.
      private boolean unicastQuery
      UnicastQueries have the highest bit of the CLASS field set to 1.
    • Constructor Summary

      Constructors 
      Constructor Description
      Question​(java.lang.String name, Record.TYPE type)
      Create a dns question for the given name/type/IN (internet class).
      Question​(java.lang.String name, Record.TYPE type, Record.CLASS clazz)
      Create a dns question for the given name/type/class.
      Question​(java.lang.String name, Record.TYPE type, Record.CLASS clazz, boolean unicastQuery)
      Create a dns question for the given name/type/class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      Record.CLASS getClazz()
      Retrieve the class of this dns question (usually internet).
      java.lang.String getName()
      Retrieve the name of this dns question (e.g.
      Record.TYPE getType()
      Retrieve the type of this question.
      int hashCode()  
      static Question parse​(java.io.DataInputStream dis, byte[] data)
      Parse a byte array and rebuild the dns question from it.
      byte[] toByteArray()
      Generate a binary paket for this dns question.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private final java.lang.String name
        The question string (e.g. "measite.de").
      • type

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

        private final Record.CLASS clazz
        The question class (usually IN / 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 Detail

      • Question

        public Question​(java.lang.String 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).
      • Question

        public Question​(java.lang.String 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​(java.lang.String 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.
    • Method Detail

      • getType

        public Record.TYPE getType()
        Retrieve the type of this question.
        Returns:
        The type.
      • getClazz

        public Record.CLASS getClazz()
        Retrieve the class of this dns question (usually internet).
        Returns:
        The class of this dns question.
      • getName

        public java.lang.String getName()
        Retrieve the name of this dns question (e.g. "measite.de").
        Returns:
        The name of this dns question.
      • parse

        public static Question parse​(java.io.DataInputStream dis,
                                     byte[] data)
                              throws java.io.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).
        Returns:
        The parsed dns question.
        Throws:
        java.io.IOException - On errors (read outside of packet).
      • toByteArray

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

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

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object