MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / canonicalize

Method canonicalize

src/main/java/core/org/xbill/DNS/Name.java:481–499  ·  view source on GitHub ↗

Returns a canonicalized version of the Name (all lowercase). This may be the same name, if the input Name is already canonical.

()

Source from the content-addressed store, hash-verified

479 * the same name, if the input Name is already canonical.
480 */
481public Name
482canonicalize() {
483 boolean canonical = true;
484 for (int i = 0; i < name.length; i++) {
485 if (lowercase[name[i] & 0xFF] != name[i]) {
486 canonical = false;
487 break;
488 }
489 }
490 if (canonical)
491 return this;
492
493 Name newname = new Name();
494 newname.appendSafe(name, offset(0), getlabels());
495 for (int i = 0; i < newname.name.length; i++)
496 newname.name[i] = lowercase[newname.name[i] & 0xFF];
497
498 return newname;
499}
500
501/**
502 * Generates a new Name to be used when following a DNAME.

Callers

nothing calls this directly

Calls 3

appendSafeMethod · 0.95
offsetMethod · 0.95
getlabelsMethod · 0.95

Tested by

no test coverage detected