DNSMessage
Date: 2017-02-10

javax.jmdns.impl

## Class DNSMessage

- java.lang.Object
- - javax.jmdns.impl.DNSMessage

- Direct Known Subclasses:
    DNSIncoming, DNSOutgoing

      public abstract class DNSMessage
      extends java.lang.Object

  DNSMessage define a DNS message either incoming or outgoing.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<DNSRecord>` | `_additionals`
    `protected java.util.List<DNSRecord>` | `_answers`
    `protected java.util.List<DNSRecord>` | `_authoritativeAnswers`
    `protected java.util.List<DNSQuestion>` | `_questions`
    `static boolean` | `MULTICAST`
    `static boolean` | `UNICAST`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DNSMessage(int flags, int id, boolean multicast)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Collection<? extends DNSRecord>` | `getAdditionals()`
    `java.util.Collection<? extends DNSRecord>` | `getAllAnswers()`
    `java.util.Collection<? extends DNSRecord>` | `getAnswers()`
    `java.util.Collection<? extends DNSRecord>` | `getAuthorities()`
    `int` | `getFlags()`
    `int` | `getId()`
    `int` | `getNumberOfAdditionals()`
    `int` | `getNumberOfAnswers()`
    `int` | `getNumberOfAuthorities()`
    `int` | `getNumberOfQuestions()`
    `java.util.Collection<? extends DNSQuestion>` | `getQuestions()`
    `boolean` | `isEmpty()` Check if the message is empty
    `boolean` | `isMulticast()`
    `boolean` | `isQuery()` Check if the message is a query.
    `boolean` | `isResponse()` Check if the message is a response.
    `boolean` | `isTruncated()` Check if the message is truncated.
    `protected java.lang.String` | `print(byte[] data)` Debugging.
    `void` | `setFlags(int flags)`
    `void` | `setId(int id)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MULTICAST

          public static final boolean MULTICAST

      See Also:
        Constant Field Values

    - #### UNICAST

          public static final boolean UNICAST

      See Also:
        Constant Field Values

    - #### _questions

          protected final java.util.List<DNSQuestion> _questions

    - #### _answers

          protected final java.util.List<DNSRecord> _answers

    - #### _authoritativeAnswers

          protected final java.util.List<DNSRecord> _authoritativeAnswers

    - #### _additionals

          protected final java.util.List<DNSRecord> _additionals

  - ### Constructor Detail

    - #### DNSMessage

          protected DNSMessage(int flags,
                    int id,
                    boolean multicast)

      Parameters:
        `flags` -
        `id` -
        `multicast` -

  - ### Method Detail

    - #### getId

          public int getId()

      Returns:
        message id

    - #### setId

          public void setId(int id)

      Parameters:
        `id` - the id to set

    - #### getFlags

          public int getFlags()

      Returns:
        message flags

    - #### setFlags

          public void setFlags(int flags)

      Parameters:
        `flags` - the flags to set

    - #### isMulticast

          public boolean isMulticast()

      Returns:
        true if multicast

    - #### getQuestions

          public java.util.Collection<? extends DNSQuestion> getQuestions()

      Returns:
        list of questions

    - #### getNumberOfQuestions

          public int getNumberOfQuestions()

      Returns:
        number of questions in the message

    - #### getAllAnswers

          public java.util.Collection<? extends DNSRecord> getAllAnswers()

    - #### getAnswers

          public java.util.Collection<? extends DNSRecord> getAnswers()

      Returns:
        list of answers

    - #### getNumberOfAnswers

          public int getNumberOfAnswers()

      Returns:
        number of answers in the message

    - #### getAuthorities

          public java.util.Collection<? extends DNSRecord> getAuthorities()

      Returns:
        list of authorities

    - #### getNumberOfAuthorities

          public int getNumberOfAuthorities()

      Returns:
        number of authorities in the message

    - #### getAdditionals

          public java.util.Collection<? extends DNSRecord> getAdditionals()

      Returns:
        list of additional answers

    - #### getNumberOfAdditionals

          public int getNumberOfAdditionals()

      Returns:
        number of additional in the message

    - #### isTruncated

          public boolean isTruncated()

      Check if the message is truncated.
      Returns:
        true if the message was truncated

    - #### isQuery

          public boolean isQuery()

      Check if the message is a query.
      Returns:
        true is the message is a query

    - #### isResponse

          public boolean isResponse()

      Check if the message is a response.
      Returns:
        true is the message is a response

    - #### isEmpty

          public boolean isEmpty()

      Check if the message is empty
      Returns:
        true is the message is empty

    - #### print

          protected java.lang.String print(byte[] data)

      Debugging.
      Parameters:
        `data` -
      Returns:
        data dump