summaryrefslogtreecommitdiff
path: root/libjava/java/net/VMInetAddress.java
diff options
context:
space:
mode:
authorgary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-03 10:16:04 +0000
committergary <gary@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-03 10:16:04 +0000
commitcf9498a89fd346d3e9989cb6480ebc495ef40345 (patch)
tree8a6600d7ecfed57029e5fe6bcacbb895c3ca5b97 /libjava/java/net/VMInetAddress.java
parentd544e7d32e6c6901358ee5465a633aaf49690512 (diff)
downloadgcc-cf9498a89fd346d3e9989cb6480ebc495ef40345.tar.gz
2006-11-03 Gary Benson <gbenson@redhat.com>
* java/net/InetAddress.java: Removed. * java/net/natInetAddressNoNet.cc: Likewise. * java/net/natInetAddressPosix.cc: Likewise. * java/net/natInetAddressWin32.cc: Likewise. * java/net/VMInetAddress.java (getLocalHostname, lookupInaddrAny, getHostByAddr, getHostByName, aton): Replace glue methods with native ones. * java/net/natVMInetAddressNoNet.cc: New file. * java/net/natVMInetAddressPosix.cc: Likewise. * java/net/natVMInetAddressWin32.cc: Likewise. * Makefile.am, configure.ac: Reflect the above. * sources.am, Makefile.in, configure: Rebuilt. * java/net/natVMNetworkInterfaceWin32.cc (winsock2GetRealNetworkInterfaces): Create InetAddress objects using InetAddress.getByAddress. * gnu/java/net/natPlainSocketImplWin32.cc (accept, getOption): Likewise. * gnu/java/net/natPlainDatagramSocketImplWin32.cc (peekData, receive, getOption): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118451 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/VMInetAddress.java')
-rw-r--r--libjava/java/net/VMInetAddress.java34
1 files changed, 7 insertions, 27 deletions
diff --git a/libjava/java/net/VMInetAddress.java b/libjava/java/net/VMInetAddress.java
index b10cf252874..a99c216b96c 100644
--- a/libjava/java/net/VMInetAddress.java
+++ b/libjava/java/net/VMInetAddress.java
@@ -58,18 +58,12 @@ class VMInetAddress implements Serializable
*
* @return The local hostname.
*/
- public static String getLocalHostname()
- {
- return InetAddress.getLocalHostname();
- }
+ public static native String getLocalHostname();
/**
* Returns the value of the special address INADDR_ANY
*/
- public static byte[] lookupInaddrAny() throws UnknownHostException
- {
- return new byte[] {0, 0, 0, 0};
- }
+ public static native byte[] lookupInaddrAny() throws UnknownHostException;
/**
* This method returns the hostname for a given IP address. It will
@@ -81,26 +75,15 @@ class VMInetAddress implements Serializable
*
* @exception UnknownHostException If the reverse lookup fails
*/
- public static String getHostByAddr(byte[] ip) throws UnknownHostException
- {
- InetAddress addr = InetAddress.getByAddress(ip);
- InetAddress.lookup(null, addr, false);
- return addr.getHostName();
- }
+ public static native String getHostByAddr(byte[] ip)
+ throws UnknownHostException;
/**
* Returns a list of all IP addresses for a given hostname. Will throw
* an UnknownHostException if the hostname cannot be resolved.
*/
- public static byte[][] getHostByName(String hostname)
- throws UnknownHostException
- {
- InetAddress[] iaddrs = InetAddress.lookup(hostname, null, true);
- byte[][] addrs = new byte[iaddrs.length][];
- for (int i = 0; i < iaddrs.length; i++)
- addrs[i] = iaddrs[i].getAddress();
- return addrs;
- }
+ public static native byte[][] getHostByName(String hostname)
+ throws UnknownHostException;
/**
* Return the IP address represented by a literal address.
@@ -110,8 +93,5 @@ class VMInetAddress implements Serializable
*
* @return The IP address as a byte array
*/
- public static byte[] aton(String address)
- {
- return InetAddress.aton(address);
- }
+ public static native byte[] aton(String address);
}