blob: 7c8b51b067adf832aab374d2638203f75aa1b0a7 [file] [log] [blame]
Shuyi Chend7955ce2013-05-22 14:51:55 -07001// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
2package org.xbill.DNS;
3
4import java.io.*;
5
6import 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 */
14public class GenericEDNSOption extends EDNSOption {
15
16private byte [] data;
17
18GenericEDNSOption(int code) {
19 super(code);
20}
21
22/**
23 * Construct a generic EDNS option.
24 * @param data The contents of the option.
25 */
26public
27GenericEDNSOption(int code, byte [] data) {
28 super(code);
29 this.data = Record.checkByteArrayLength("option data", data, 0xFFFF);
30}
31
32void
33optionFromWire(DNSInput in) throws IOException {
34 data = in.readByteArray();
35}
36
37void
38optionToWire(DNSOutput out) {
39 out.writeByteArray(data);
40}
41
42String
43optionToString() {
44 return "<" + base16.toString(data) + ">";
45}
46
47}