Returns an array containing all records in the given section grouped into RRsets. @see RRset @see Section
(int section)
| 362 | * @see Section |
| 363 | */ |
| 364 | public RRset [] |
| 365 | getSectionRRsets(int section) { |
| 366 | if (sections[section] == null) |
| 367 | return emptyRRsetArray; |
| 368 | List sets = new LinkedList(); |
| 369 | Record [] recs = getSectionArray(section); |
| 370 | Set hash = new HashSet(); |
| 371 | for (int i = 0; i < recs.length; i++) { |
| 372 | Name name = recs[i].getName(); |
| 373 | boolean newset = true; |
| 374 | if (hash.contains(name)) { |
| 375 | for (int j = sets.size() - 1; j >= 0; j--) { |
| 376 | RRset set = (RRset) sets.get(j); |
| 377 | if (set.getType() == recs[i].getRRsetType() && |
| 378 | set.getDClass() == recs[i].getDClass() && |
| 379 | set.getName().equals(name)) |
| 380 | { |
| 381 | set.addRR(recs[i]); |
| 382 | newset = false; |
| 383 | break; |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | if (newset) { |
| 388 | RRset set = new RRset(recs[i]); |
| 389 | sets.add(set); |
| 390 | hash.add(name); |
| 391 | } |
| 392 | } |
| 393 | return (RRset []) sets.toArray(new RRset[sets.size()]); |
| 394 | } |
| 395 | |
| 396 | void |
| 397 | toWire(DNSOutput out) { |
no test coverage detected