示例#1
0
 /** Converts the Message to a String. */
 public String toString() {
   StringBuffer sb = new StringBuffer();
   OPTRecord opt = getOPT();
   if (opt != null) sb.append(header.toStringWithRcode(getRcode()) + "\n");
   else sb.append(header + "\n");
   if (isSigned()) {
     sb.append(";; TSIG ");
     if (isVerified()) sb.append("ok");
     else sb.append("invalid");
     sb.append('\n');
   }
   if (opt != null) {
     sb.append(";; OPT PSEUDOSECTION:\n");
     sb.append(";  EDNS: version: ");
     sb.append(opt.getVersion());
     sb.append(", flags:");
     if ((opt.getFlags() & ExtendedFlags.DO) != 0) {
       sb.append(" do");
     }
     sb.append("; udp: ");
     sb.append(opt.getPayloadSize());
     sb.append("\n");
   }
   for (int i = 0; i < 4; i++) {
     if (header.getOpcode() != Opcode.UPDATE) sb.append(";; " + Section.longString(i) + ":\n");
     else sb.append(";; " + Section.updString(i) + ":\n");
     sb.append(sectionToString(i) + "\n");
   }
   sb.append(";; Message size: " + numBytes() + " bytes");
   return sb.toString();
 }
示例#2
0
 /** Converts the Message to a String. */
 public String toString() {
   StringBuffer sb = new StringBuffer();
   OPTRecord opt = getOPT();
   if (opt != null) sb.append(header.toStringWithRcode(getRcode()) + "\n");
   else sb.append(header + "\n");
   if (isSigned()) {
     sb.append(";; TSIG ");
     if (isVerified()) sb.append("ok");
     else sb.append("invalid");
     sb.append('\n');
   }
   for (int i = 0; i < 4; i++) {
     if (header.getOpcode() != Opcode.UPDATE) sb.append(";; " + Section.longString(i) + ":\n");
     else sb.append(";; " + Section.updString(i) + ":\n");
     sb.append(sectionToString(i) + "\n");
   }
   sb.append(";; Message size: " + numBytes() + " bytes");
   return sb.toString();
 }