aboutsummaryrefslogtreecommitdiff
path: root/src/org/xbill/DNS/SingleNameBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/xbill/DNS/SingleNameBase.java')
-rw-r--r--src/org/xbill/DNS/SingleNameBase.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/org/xbill/DNS/SingleNameBase.java b/src/org/xbill/DNS/SingleNameBase.java
new file mode 100644
index 0000000..6d6c041
--- /dev/null
+++ b/src/org/xbill/DNS/SingleNameBase.java
@@ -0,0 +1,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);
+}
+
+}