• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2 package org.xbill.DNS;
3 
4 import java.io.*;
5 
6 import org.xbill.DNS.utils.base16;
7 
8 /**
9  * An EDNSOption with no internal structure.
10  *
11  * @author Ming Zhou <mizhou@bnivideo.com>, Beaumaris Networks
12  * @author Brian Wellington
13  */
14 public class GenericEDNSOption extends EDNSOption {
15 
16 private byte [] data;
17 
GenericEDNSOption(int code)18 GenericEDNSOption(int code) {
19 	super(code);
20 }
21 
22 /**
23  * Construct a generic EDNS option.
24  * @param data The contents of the option.
25  */
26 public
GenericEDNSOption(int code, byte [] data)27 GenericEDNSOption(int code, byte [] data) {
28 	super(code);
29 	this.data = Record.checkByteArrayLength("option data", data, 0xFFFF);
30 }
31 
32 void
optionFromWire(DNSInput in)33 optionFromWire(DNSInput in) throws IOException {
34 	data = in.readByteArray();
35 }
36 
37 void
optionToWire(DNSOutput out)38 optionToWire(DNSOutput out) {
39 	out.writeByteArray(data);
40 }
41 
42 String
optionToString()43 optionToString() {
44 	return "<" + base16.toString(data) + ">";
45 }
46 
47 }
48