1
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
8
* Host Information - describes the CPU and OS of a host
10
* @author Brian Wellington
13
public class HINFORecord extends Record {
15
private byte [] cpu, os;
21
return new HINFORecord();
25
* Creates an HINFO Record from the given data
26
* @param cpu A string describing the host's CPU
27
* @param os A string describing the host's OS
28
* @throws IllegalArgumentException One of the strings has invalid escapes
31
HINFORecord(Name name, int dclass, long ttl, String cpu, String os) {
32
super(name, Type.HINFO, dclass, ttl);
34
this.cpu = byteArrayFromString(cpu);
35
this.os = byteArrayFromString(os);
37
catch (TextParseException e) {
38
throw new IllegalArgumentException(e.getMessage());
43
rrFromWire(DNSInput in) throws IOException {
44
cpu = in.readCountedString();
45
os = in.readCountedString();
49
rdataFromString(Tokenizer st, Name origin) throws IOException {
51
cpu = byteArrayFromString(st.getString());
52
os = byteArrayFromString(st.getString());
54
catch (TextParseException e) {
55
throw st.exception(e.getMessage());
60
* Returns the host's CPU
64
return byteArrayToString(cpu, false);
68
* Returns the host's OS
72
return byteArrayToString(os, false);
76
rrToWire(DNSOutput out, Compression c, boolean canonical) {
77
out.writeCountedString(cpu);
78
out.writeCountedString(os);
82
* Converts to a string
86
StringBuffer sb = new StringBuffer();
87
sb.append(byteArrayToString(cpu, true));
89
sb.append(byteArrayToString(os, true));