01: // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
02:
03: package org.xbill.DNS;
04:
05: import java.io.*;
06:
07: /**
08: * Implements common functionality for the many record types whose format
09: * is a single name.
10: *
11: * @author Brian Wellington
12: */
13:
14: abstract class SingleNameBase extends Record {
15:
16: protected Name singleName;
17:
18: protected SingleNameBase() {
19: }
20:
21: protected SingleNameBase(Name name, int type, int dclass, long ttl) {
22: super (name, type, dclass, ttl);
23: }
24:
25: protected SingleNameBase(Name name, int type, int dclass, long ttl,
26: Name singleName, String description) {
27: super (name, type, dclass, ttl);
28: this .singleName = checkName(description, singleName);
29: }
30:
31: void rrFromWire(DNSInput in) throws IOException {
32: singleName = new Name(in);
33: }
34:
35: void rdataFromString(Tokenizer st, Name origin) throws IOException {
36: singleName = st.getName(origin);
37: }
38:
39: String rrToString() {
40: return singleName.toString();
41: }
42:
43: protected Name getSingleName() {
44: return singleName;
45: }
46:
47: void rrToWire(DNSOutput out, Compression c, boolean canonical) {
48: singleName.toWire(out, null, canonical);
49: }
50:
51: }
|