All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xbill.DNS.GenericEDNSOption Maven / Gradle / Ivy

There is a newer version: 3.6.2_1
Show newest version
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 1999-2004 Brian Wellington ([email protected])
package org.xbill.DNS;

import org.xbill.DNS.utils.base16;

/**
 * An EDNSOption with no internal structure.
 *
 * @author Ming Zhou <[email protected]>, Beaumaris Networks
 * @author Brian Wellington
 */
public class GenericEDNSOption extends EDNSOption {

  private byte[] data;

  GenericEDNSOption(int code) {
    super(code);
  }

  /**
   * Construct a generic EDNS option.
   *
   * @param data The contents of the option.
   */
  public GenericEDNSOption(int code, byte[] data) {
    super(code);
    this.data = Record.checkByteArrayLength("option data", data, 0xFFFF);
  }

  @Override
  void optionFromWire(DNSInput in) {
    data = in.readByteArray();
  }

  @Override
  void optionToWire(DNSOutput out) {
    out.writeByteArray(data);
  }

  @Override
  String optionToString() {
    return "<" + base16.toString(data) + ">";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy