Determines the hostname for an address @param addr The address to look up @return The associated host name @exception UnknownHostException There is no hostname for the address
(InetAddress addr)
| 352 | * @exception UnknownHostException There is no hostname for the address |
| 353 | */ |
| 354 | public static String |
| 355 | getHostName(InetAddress addr) throws UnknownHostException { |
| 356 | Name name = ReverseMap.fromAddress(addr); |
| 357 | Record [] records = new Lookup(name, Type.PTR).run(); |
| 358 | if (records == null) |
| 359 | throw new UnknownHostException("unknown address"); |
| 360 | PTRRecord ptr = (PTRRecord) records[0]; |
| 361 | return ptr.getTarget().toString(); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Returns the family of an InetAddress. |
nothing calls this directly
no test coverage detected