public static InetAddress getByAddress ( String addr , int family ) throws UnknownHostException { if ( family != IPv4 && family != IPv6 ) throw new IllegalArgumentException ( "unknown address family" ) ; byte [ ] bytes ; bytes = toByteArray ( addr , family ) ; if ( bytes != null ) return InetAddress . getByAddress ( bytes ) ; throw new UnknownHostException ( "Invalid address: " + addr ) ; }
Converts an address from its string representation to an IP address in a particular family .