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

Method rrToString

src/main/java/core/org/xbill/DNS/AAAARecord.java:50–69  ·  view source on GitHub ↗

Converts rdata to a String

()

Source from the content-addressed store, hash-verified

48
49/** Converts rdata to a String */
50String
51rrToString() {
52 InetAddress addr;
53 try {
54 addr = InetAddress.getByAddress(null, address);
55 } catch (UnknownHostException e) {
56 return null;
57 }
58 if (addr.getAddress().length == 4) {
59 // Deal with Java's broken handling of mapped IPv4 addresses.
60 StringBuffer sb = new StringBuffer("0:0:0:0:0:ffff:");
61 int high = ((address[12] & 0xFF) << 8) + (address[13] & 0xFF);
62 int low = ((address[14] & 0xFF) << 8) + (address[15] & 0xFF);
63 sb.append(Integer.toHexString(high));
64 sb.append(':');
65 sb.append(Integer.toHexString(low));
66 return sb.toString();
67 }
68 return addr.getHostAddress();
69}
70
71/** Returns the address */
72public InetAddress

Callers

nothing calls this directly

Calls 5

getByAddressMethod · 0.80
toHexStringMethod · 0.80
getAddressMethod · 0.65
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected