1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
10 import org.ibex.util.*;
14 /** construct an IP address from four bytes; doesn't throw an exception */
15 public static InetAddress getIP(int a, int b, int c, int d) {
17 return InetAddress.getByAddress(new byte[] { (byte)a, (byte)b, (byte)c, (byte)d });
18 } catch (Exception e) {
19 Log.error(IP.class, e);
24 public static String toString(InetAddress pi) {
26 (pi.getAddress()[0]&0xff) + "." +
27 (pi.getAddress()[1]&0xff) + "." +
28 (pi.getAddress()[2]&0xff) + "." +
29 (pi.getAddress()[3]&0xff);