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

com.couchbase.client.core.deps.org.xbill.DNS.DHCIDRecord Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2008 Brian Wellington ([email protected])

package com.couchbase.client.core.deps.org.xbill.DNS;

import java.io.IOException;
import com.couchbase.client.core.deps.org.xbill.DNS.utils.base64;

/**
 * DHCID - Dynamic Host Configuration Protocol (DHCP) ID (RFC 4701)
 *
 * @author Brian Wellington
 * @see RFC 4701: A DNS Resource Record (RR) for
 *     Encoding Dynamic Host Configuration Protocol (DHCP) Information (DHCID RR)
 */
public class DHCIDRecord extends Record {
  private byte[] data;

  DHCIDRecord() {}

  /**
   * Creates an DHCID Record from the given data
   *
   * @param data The binary data, which is opaque to DNS.
   */
  public DHCIDRecord(Name name, int dclass, long ttl, byte[] data) {
    super(name, Type.DHCID, dclass, ttl);
    this.data = data;
  }

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

  @Override
  protected void rdataFromString(Tokenizer st, Name origin) throws IOException {
    data = st.getBase64();
  }

  @Override
  protected void rrToWire(DNSOutput out, Compression c, boolean canonical) {
    out.writeByteArray(data);
  }

  @Override
  protected String rrToString() {
    return base64.toString(data);
  }

  /** Returns the binary data. */
  public byte[] getData() {
    return data;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy