< prev index next > src/java.base/share/classes/java/net/Inet4AddressImpl.java
Print this page
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.net;
import java.io.IOException;
/*
* Package private implementation of InetAddressImpl for IPv4.
*
* @since 1.4
*/
final class Inet4AddressImpl implements InetAddressImpl {
public native String getLocalHostName() throws UnknownHostException;
! public native InetAddress[]
! lookupAllHostAddr(String hostname) throws UnknownHostException;
public native String getHostByAddr(byte[] addr) throws UnknownHostException;
private native boolean isReachable0(byte[] addr, int timeout, byte[] ifaddr, int ttl) throws IOException;
public synchronized InetAddress anyLocalAddress() {
if (anyLocalAddress == null) {
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.net;
import java.io.IOException;
+ import java.net.spi.InetAddressResolver.LookupPolicy;
+
+ import static java.net.spi.InetAddressResolver.LookupPolicy.IPV4;
/*
* Package private implementation of InetAddressImpl for IPv4.
*
* @since 1.4
*/
final class Inet4AddressImpl implements InetAddressImpl {
public native String getLocalHostName() throws UnknownHostException;
! public InetAddress[] lookupAllHostAddr(String hostname, LookupPolicy lookupPolicy)
! throws UnknownHostException {
+ if ((lookupPolicy.characteristics() & IPV4) == 0) {
+ throw new UnknownHostException(hostname);
+ }
+ return lookupAllHostAddr(hostname);
+ }
+ private native InetAddress[] lookupAllHostAddr(String hostname) throws UnknownHostException;
public native String getHostByAddr(byte[] addr) throws UnknownHostException;
private native boolean isReachable0(byte[] addr, int timeout, byte[] ifaddr, int ttl) throws IOException;
public synchronized InetAddress anyLocalAddress() {
if (anyLocalAddress == null) {
< prev index next >