1 // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org) 2 3 package org.xbill.DNS; 4 5 import java.io.*; 6 7 /** 8 * A class implementing Records of unknown and/or unimplemented types. This 9 * class can only be initialized using static Record initializers. 10 * 11 * @author Brian Wellington 12 */ 13 14 public class UNKRecord extends Record { 15 16 private static final long serialVersionUID = -4193583311594626915L; 17 18 private byte [] data; 19 UNKRecord()20UNKRecord() {} 21 22 Record getObject()23getObject() { 24 return new UNKRecord(); 25 } 26 27 void rrFromWire(DNSInput in)28rrFromWire(DNSInput in) throws IOException { 29 data = in.readByteArray(); 30 } 31 32 void rdataFromString(Tokenizer st, Name origin)33rdataFromString(Tokenizer st, Name origin) throws IOException { 34 throw st.exception("invalid unknown RR encoding"); 35 } 36 37 /** Converts this Record to the String "unknown format" */ 38 String rrToString()39rrToString() { 40 return unknownToString(data); 41 } 42 43 /** Returns the contents of this record. */ 44 public byte [] getData()45getData() { 46 return data; 47 } 48 49 void rrToWire(DNSOutput out, Compression c, boolean canonical)50rrToWire(DNSOutput out, Compression c, boolean canonical) { 51 out.writeByteArray(data); 52 } 53 54 } 55