com.couchbase.client.core.deps.org.xbill.DNS.DHCIDRecord Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-io Show documentation
Show all versions of core-io Show documentation
The official Couchbase JVM Core IO Library
// 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;
}
}