Esempio n. 1
0
 public static void main(String[] args) throws Exception {
   int type = Type.A;
   int start = 0;
   if (args.length > 2 && args[0].equals("-t")) {
     type = Type.value(args[1]);
     if (type < 0) {
       throw new IllegalArgumentException("invalid type");
     }
     start = 2;
   }
   for (int i = start; i < args.length; i++) {
     Lookup l = new Lookup(args[i], type);
     l.run();
     printAnswer(args[i], l);
   }
 }
  private static String createQuery(final Record query) {
    if (query != null && query.getName() != null) {
      final String qname = query.getName().toString();
      final String qtype = Type.string(query.getType());
      final String qclass = DClass.string(query.getDClass());

      return new StringBuilder()
          .append("fqdn=")
          .append(qname)
          .append(" type=")
          .append(qtype)
          .append(" class=")
          .append(qclass)
          .toString();
    }
    return "";
  }