mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8244202: Implementation of JEP 418: Internet-Address Resolution SPI
Co-authored-by: Chris Hegarty <chegar@openjdk.org> Co-authored-by: Daniel Fuchs <dfuchs@openjdk.org> Co-authored-by: Alan Bateman <alanb@openjdk.org> Reviewed-by: dfuchs, alanb, michaelm, chegar
This commit is contained in:
parent
c29cab8ab4
commit
2ca4ff87b7
56 changed files with 2986 additions and 293 deletions
|
@ -24,6 +24,9 @@
|
|||
*/
|
||||
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.
|
||||
|
@ -32,8 +35,14 @@ import java.io.IOException;
|
|||
*/
|
||||
final class Inet4AddressImpl implements InetAddressImpl {
|
||||
public native String getLocalHostName() throws UnknownHostException;
|
||||
public native InetAddress[]
|
||||
lookupAllHostAddr(String hostname) 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue