Converts rdata to a String
()
| 48 | |
| 49 | /** Converts rdata to a String */ |
| 50 | String |
| 51 | rrToString() { |
| 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 */ |
| 72 | public InetAddress |
nothing calls this directly
no test coverage detected