Beispiel #1
0
 /**
  * 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;
 }
 public String host() {
   return IDN.toUnicode(this.host);
 }