aboutsummaryrefslogtreecommitdiff
path: root/src/org/xbill/DNS/SingleNameBase.java
blob: 6d6c0415c49da556653eb1f390f07aefac747ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

import java.io.*;

/**
 * Implements common functionality for the many record types whose format
 * is a single name.
 *
 * @author Brian Wellington
 */

abstract class SingleNameBase extends Record {

private static final long serialVersionUID = -18595042501413L;

protected Name singleName;

protected
SingleNameBase() {}

protected
SingleNameBase(Name name, int type, int dclass, long ttl) {
	super(name, type, dclass, ttl);
}

protected
SingleNameBase(Name name, int type, int dclass, long ttl, Name singleName,
	    String description)
{
	super(name, type, dclass, ttl);
	this.singleName = checkName(description, singleName);
}

void
rrFromWire(DNSInput in) throws IOException {
	singleName = new Name(in);
}

void
rdataFromString(Tokenizer st, Name origin) throws IOException {
	singleName = st.getName(origin);
}

String
rrToString() {
	return singleName.toString();
}

protected Name
getSingleName() {
	return singleName;
}

void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
	singleName.toWire(out, null, canonical);
}

}