This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 public class InetAddress {
2     String hostname;
3     byte[] address;
4
5     public InetAddress(byte[] addr, String hostname) {
6         this.hostname=hostname;
7         this.address=addr;
8     }
9     
10     public static InetAddress getByAddress(String host, byte[] addr) {
11         return new InetAddress(addr, host);
12     }
13
14     public static InetAddress getByName(String hostname) {
15         InetAddress[] addresses=getAllByName(hostname);
16         return addresses[0];
17     }
18     
19     public byte[] getAddress() {
20         return address;
21     }
22
23     public static InetAddress[] getAllByName(String hostname) {
24         InetAddress[] addresses;
25         
26         byte[][] iplist = InetAddress.getHostByName(hostname.getBytes());
27         
28         addresses = new InetAddress[iplist.length];
29         
30         for (int i = 0; i < iplist.length; i++) {
31             addresses[i] = new InetAddress(iplist[i], hostname);
32         }
33         return addresses;
34     }
35
36     public static native byte[][] getHostByName(byte[] hostname);
37 }