org.minidns.edns

## Class EdnsOption

- java.lang.Object
- - org.minidns.edns.EdnsOption

- Direct Known Subclasses:
    Nsid, UnknownEdnsOption

      public abstract class EdnsOption
      extends Object

  Abstract base class for EDNS options.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `optionCode` The EDNS option code.
    `protected byte[]` | `optionData` The raw option data.
    `int` | `optionLength` The length of the option data.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EdnsOption(byte[] optionData)` Creates a new EDNS option with the specified data.
    `protected` | `EdnsOption(int optionCode, byte[] optionData)` Creates a new EDNS option with the specified option code and data.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `asTerminalOutput()` Returns the terminal output representation of this EDNS option.
    `protected abstract CharSequence` | `asTerminalOutputInternal()` Returns the terminal output representation of this EDNS option.
    `abstract Edns.OptionCode` | `getOptionCode()` Returns the option code for this EDNS option.
    `static EdnsOption` | `parse(int intOptionCode, byte[] optionData)` Parses an EDNS option from the specified option code and data.
    `String` | `toString()`
    `protected abstract CharSequence` | `toStringInternal()` Returns the string representation of this EDNS option.
    `void` | `writeToDos(DataOutputStream dos)` Writes this EDNS option to the specified data output stream.

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

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

- - ### Field Detail

    - #### optionCode

          public final int optionCode

      The EDNS option code.

    - #### optionData

          protected final byte[] optionData

      The raw option data.

    - #### optionLength

          public final int optionLength

      The length of the option data.

  - ### Constructor Detail

    - #### EdnsOption

          protected EdnsOption(byte[] optionData)

      Creates a new EDNS option with the specified data. The option code is derived from the concrete implementation.
      Parameters:
        `optionData` - the option data

    - #### EdnsOption

          protected EdnsOption(int optionCode,
                               byte[] optionData)

      Creates a new EDNS option with the specified option code and data.
      Parameters:
        `optionCode` - the option code
        `optionData` - the option data

  - ### Method Detail

    - #### asTerminalOutput

          public final String asTerminalOutput()

      Returns the terminal output representation of this EDNS option.
      Returns:
        the terminal output representation

    - #### asTerminalOutputInternal

          protected abstract CharSequence asTerminalOutputInternal()

      Returns the terminal output representation of this EDNS option.
      Returns:
        the terminal output representation

    - #### getOptionCode

          public abstract Edns.OptionCode getOptionCode()

      Returns the option code for this EDNS option.
      Returns:
        the option code

    - #### parse

          public static EdnsOption parse(int intOptionCode,
                                         byte[] optionData)

      Parses an EDNS option from the specified option code and data.
      Parameters:
        `intOptionCode` - the option code as an integer
        `optionData` - the option data
      Returns:
        the parsed EDNS option

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

    - #### toStringInternal

          protected abstract CharSequence toStringInternal()

      Returns the string representation of this EDNS option.
      Returns:
        the string representation

    - #### writeToDos

          public final void writeToDos(DataOutputStream dos)
                                throws IOException

      Writes this EDNS option to the specified data output stream.
      Parameters:
        `dos` - the data output stream to write to
      Throws:
        `IOException` - if an I/O error occurs