Converts the given section of the Message to a String. @see Section
(int i)
| 561 | * @see Section |
| 562 | */ |
| 563 | public String |
| 564 | sectionToString(int i) { |
| 565 | if (i > 3) |
| 566 | return null; |
| 567 | |
| 568 | StringBuffer sb = new StringBuffer(); |
| 569 | |
| 570 | Record [] records = getSectionArray(i); |
| 571 | for (int j = 0; j < records.length; j++) { |
| 572 | Record rec = records[j]; |
| 573 | if (i == Section.QUESTION) { |
| 574 | sb.append(";;\t" + rec.name); |
| 575 | sb.append(", type = " + Type.string(rec.type)); |
| 576 | sb.append(", class = " + DClass.string(rec.dclass)); |
| 577 | } |
| 578 | else |
| 579 | sb.append(rec); |
| 580 | sb.append("\n"); |
| 581 | } |
| 582 | return sb.toString(); |
| 583 | } |
| 584 | |
| 585 | /** |
| 586 | * Converts the Message to a String. |