blob: 6d6c0415c49da556653eb1f390f07aefac747ca7 [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
2
3package org.xbill.DNS;
4
5import java.io.*;
6
7/**
8 * Implements common functionality for the many record types whose format
9 * is a single name.
10 *
11 * @author Brian Wellington
12 */
13
14abstract class SingleNameBase extends Record {
15
16private static final long serialVersionUID = -18595042501413L;
17
18protected Name singleName;
19
20protected
21SingleNameBase() {}
22
23protected
24SingleNameBase(Name name, int type, int dclass, long ttl) {
25 super(name, type, dclass, ttl);
26}
27
28protected
29SingleNameBase(Name name, int type, int dclass, long ttl, Name singleName,
30 String description)
31{
32 super(name, type, dclass, ttl);
33 this.singleName = checkName(description, singleName);
34}
35
36void
37rrFromWire(DNSInput in) throws IOException {
38 singleName = new Name(in);
39}
40
41void
42rdataFromString(Tokenizer st, Name origin) throws IOException {
43 singleName = st.getName(origin);
44}
45
46String
47rrToString() {
48 return singleName.toString();
49}
50
51protected Name
52getSingleName() {
53 return singleName;
54}
55
56void
57rrToWire(DNSOutput out, Compression c, boolean canonical) {
58 singleName.toWire(out, null, canonical);
59}
60
61}