private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress makeInetAddress(byte[] bytes, String hostName) throws UnknownHostException { if (bytes.length == 4) { return new Inet4Address(bytes, hostName); } else if (bytes.length == 16) { return new Inet6Address(bytes, hostName, 0); } else { throw badAddressLength(bytes); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } //else if (ipAddress.length == 16) { // // First check to see if the address is an IPv6-mapped // // IPv4 address. If it is, then we can make it a IPv4 // // address, otherwise, we'll create an IPv6 address. // if (isIPv4MappedAddress(ipAddress)) { // return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); // } else { // return new Inet6Address(ipAddress.clone(), hostName, scopeId); // } //} else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }
private static InetAddress getByAddress(String hostName, byte[] ipAddress, int scopeId) throws UnknownHostException { if (ipAddress == null) { throw new UnknownHostException("ipAddress == null"); } if (ipAddress.length == 4) { return new Inet4Address(ipAddress.clone(), hostName); } else if (ipAddress.length == 16) { // First check to see if the address is an IPv6-mapped // IPv4 address. If it is, then we can make it a IPv4 // address, otherwise, we'll create an IPv6 address. if (isIPv4MappedAddress(ipAddress)) { return new Inet4Address(ipv4MappedToIPv4(ipAddress), hostName); } else { return new Inet6Address(ipAddress.clone(), hostName, scopeId); } } else { throw badAddressLength(ipAddress); } }