@Override public void parse(DataInputStream dis, byte[] data, int length) throws IOException { this.name = NameUtil.parse(dis, data); }
@Override public void parse(DataInputStream dis, byte[] data, int length) throws IOException { this.priority = dis.readUnsignedShort(); this.name = NameUtil.parse(dis, data); }
@Override public void parse(DataInputStream dis, byte[] data, int length) throws IOException { this.priority = dis.readUnsignedShort(); this.weight = dis.readUnsignedShort(); this.port = dis.readUnsignedShort(); this.name = NameUtil.parse(dis, data); }
/** * Parse a domain name starting at the current offset and moving the input * stream pointer past this domain name (even if cross references occure). * @param dis The input stream. * @param data The raw data (for cross references). * @return The domain name string. * @throws IOException Should never happen. */ public static String parse(DataInputStream dis, byte data[]) throws IOException { int c = dis.readUnsignedByte(); if ((c & 0xc0) == 0xc0) { c = ((c & 0x3f) << 8) + dis.readUnsignedByte(); HashSet<Integer> jumps = new HashSet<Integer>(); jumps.add(c); return parse(data, c, jumps); } if (c == 0) { return ""; } byte b[] = new byte[c]; dis.readFully(b); String s = IDN.toUnicode(new String(b)); String t = parse(dis, data); if (t.length() > 0) { s = s + "." + t; } return s; }
/** * Parse a byte array and rebuild the dns question from it. * @param dis The input stream. * @param data The plain data (for dns name references). * @return The parsed dns question. * @throws IOException On errors (read outside of packet). */ public static Question parse(DataInputStream dis, byte[] data) throws IOException { String name = NameUtil.parse(dis, data); TYPE type = TYPE.getType(dis.readUnsignedShort()); CLASS clazz = CLASS.getClass(dis.readUnsignedShort()); return new Question (name, type, clazz); }
this.name = NameUtil.parse(dis, data); this.type = TYPE.getType(dis.readUnsignedShort()); int clazzValue = dis.readUnsignedShort();