List of usage examples for java.net Inet6Address getByAddress
public static InetAddress getByAddress(String host, byte[] addr) throws UnknownHostException
From source file:org.getlantern.firetweet.util.net.FiretweetHostAddressResolver.java
private InetAddress[] fromAddressString(String host, String address) throws UnknownHostException { InetAddress inetAddress = InetAddress.getByName(address); if (inetAddress instanceof Inet4Address) { return new InetAddress[] { Inet4Address.getByAddress(host, inetAddress.getAddress()) }; } else if (inetAddress instanceof Inet6Address) { return new InetAddress[] { Inet6Address.getByAddress(host, inetAddress.getAddress()) }; }/* w w w .ja va 2 s . c o m*/ throw new UnknownHostException("Bad address " + host + " = " + address); }