Package org.xbill.DNS

Class EDNSOption

java.lang.Object
org.xbill.DNS.EDNSOption
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClientSubnetOption, CookieOption, DnssecAlgorithmOption, ExtendedErrorCodeOption, GenericEDNSOption, TcpKeepaliveOption

public abstract class EDNSOption extends Object implements Serializable
DNS extension options, as described in RFC 6891. The rdata of an OPT record is defined as a list of options; this represents a single option.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EDNSOption(int code)
    Creates an option with the given option code and data.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines if two EDNS Options are identical.
    static EDNSOption
    fromWire(byte[] b)
    Converts the wire format of an EDNS Option (including code and length) into the type-specific format.
    (package private) static EDNSOption
    Converts the wire format of an EDNS Option (including code and length) into the type-specific format.
    int
    Returns the EDNS Option's code.
    (package private) byte[]
    Returns the EDNS Option's data, as a byte array.
    int
    Generates a hash code based on the EDNS Option's data.
    (package private) abstract void
    Converts the wire format of an EDNS Option (the option data only) into the type-specific format.
    (package private) abstract String
     
    (package private) abstract void
    Converts an EDNS Option (the type-specific option data only) into wire format.
     
    byte[]
    Converts an EDNS Option (including code and length) into wire format.
    (package private) void
    Converts an EDNS Option (including code and length) into wire format.

    Methods inherited from class java.lang.Object

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

    • code

      private final int code
  • Constructor Details

    • EDNSOption

      public EDNSOption(int code)
      Creates an option with the given option code and data.
  • Method Details

    • toString

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

      public int getCode()
      Returns the EDNS Option's code.
      Returns:
      the option code
    • getData

      byte[] getData()
      Returns the EDNS Option's data, as a byte array.
      Returns:
      the option data
    • optionFromWire

      abstract void optionFromWire(DNSInput in) throws IOException
      Converts the wire format of an EDNS Option (the option data only) into the type-specific format.
      Parameters:
      in - The input Stream.
      Throws:
      IOException
    • fromWire

      static EDNSOption fromWire(DNSInput in) throws IOException
      Converts the wire format of an EDNS Option (including code and length) into the type-specific format.
      Parameters:
      in - The input stream.
      Throws:
      IOException
    • fromWire

      public static EDNSOption fromWire(byte[] b) throws IOException
      Converts the wire format of an EDNS Option (including code and length) into the type-specific format.
      Returns:
      The option, in wire format.
      Throws:
      IOException
    • optionToWire

      abstract void optionToWire(DNSOutput out)
      Converts an EDNS Option (the type-specific option data only) into wire format.
      Parameters:
      out - The output stream.
    • toWire

      void toWire(DNSOutput out)
      Converts an EDNS Option (including code and length) into wire format.
      Parameters:
      out - The output stream.
    • toWire

      public byte[] toWire()
      Converts an EDNS Option (including code and length) into wire format.
      Returns:
      The option, in wire format.
    • equals

      public boolean equals(Object arg)
      Determines if two EDNS Options are identical.
      Overrides:
      equals in class Object
      Parameters:
      arg - The option to compare to
      Returns:
      true if the options are equal, false otherwise.
    • hashCode

      public int hashCode()
      Generates a hash code based on the EDNS Option's data.
      Overrides:
      hashCode in class Object
    • optionToString

      abstract String optionToString()