• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
2 
3 package org.xbill.DNS;
4 
5 import 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 
14 abstract class SingleNameBase extends Record {
15 
16 private static final long serialVersionUID = -18595042501413L;
17 
18 protected Name singleName;
19 
20 protected
SingleNameBase()21 SingleNameBase() {}
22 
23 protected
SingleNameBase(Name name, int type, int dclass, long ttl)24 SingleNameBase(Name name, int type, int dclass, long ttl) {
25 	super(name, type, dclass, ttl);
26 }
27 
28 protected
SingleNameBase(Name name, int type, int dclass, long ttl, Name singleName, String description)29 SingleNameBase(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 
36 void
rrFromWire(DNSInput in)37 rrFromWire(DNSInput in) throws IOException {
38 	singleName = new Name(in);
39 }
40 
41 void
rdataFromString(Tokenizer st, Name origin)42 rdataFromString(Tokenizer st, Name origin) throws IOException {
43 	singleName = st.getName(origin);
44 }
45 
46 String
rrToString()47 rrToString() {
48 	return singleName.toString();
49 }
50 
51 protected Name
getSingleName()52 getSingleName() {
53 	return singleName;
54 }
55 
56 void
rrToWire(DNSOutput out, Compression c, boolean canonical)57 rrToWire(DNSOutput out, Compression c, boolean canonical) {
58 	singleName.toWire(out, null, canonical);
59 }
60 
61 }
62