aboutsummaryrefslogtreecommitdiff
path: root/src/org/xbill/DNS/NULLRecord.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/xbill/DNS/NULLRecord.java')
-rw-r--r--src/org/xbill/DNS/NULLRecord.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/org/xbill/DNS/NULLRecord.java b/src/org/xbill/DNS/NULLRecord.java
new file mode 100644
index 0000000..fa46d61
--- /dev/null
+++ b/src/org/xbill/DNS/NULLRecord.java
@@ -0,0 +1,67 @@
+// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
+
+package org.xbill.DNS;
+
+import java.io.*;
+
+/**
+ * The NULL Record. This has no defined purpose, but can be used to
+ * hold arbitrary data.
+ *
+ * @author Brian Wellington
+ */
+
+public class NULLRecord extends Record {
+
+private static final long serialVersionUID = -5796493183235216538L;
+
+private byte [] data;
+
+NULLRecord() {}
+
+Record
+getObject() {
+ return new NULLRecord();
+}
+
+/**
+ * Creates a NULL record from the given data.
+ * @param data The contents of the record.
+ */
+public
+NULLRecord(Name name, int dclass, long ttl, byte [] data) {
+ super(name, Type.NULL, dclass, ttl);
+
+ if (data.length > 0xFFFF) {
+ throw new IllegalArgumentException("data must be <65536 bytes");
+ }
+ this.data = data;
+}
+
+void
+rrFromWire(DNSInput in) throws IOException {
+ data = in.readByteArray();
+}
+
+void
+rdataFromString(Tokenizer st, Name origin) throws IOException {
+ throw st.exception("no defined text format for NULL records");
+}
+
+String
+rrToString() {
+ return unknownToString(data);
+}
+
+/** Returns the contents of this record. */
+public byte []
+getData() {
+ return data;
+}
+
+void
+rrToWire(DNSOutput out, Compression c, boolean canonical) {
+ out.writeByteArray(data);
+}
+
+}