Methods Summary |
---|
public static java.lang.String | DNSToIPAddress(java.lang.String dns_name)
return( HostNameToIPResolver.syncResolve(dns_name).getHostAddress());
|
public static void | addressTo4ByteArray(java.lang.String address, byte[] buffer, int offset)
InetAddress i_address = HostNameToIPResolver.syncResolve(address);
byte[] bytes = i_address.getAddress();
System.arraycopy( bytes, 0, buffer, offset, 4 );
|
public static int | addressToInt(java.lang.String address)
InetAddress i_address = HostNameToIPResolver.syncResolve(address);
byte[] bytes = i_address.getAddress();
int resp = (bytes[0]<<24)&0xff000000 | (bytes[1] << 16)&0x00ff0000 | (bytes[2] << 8)&0x0000ff00 | bytes[3]&0x000000ff;
// System.out.println( "addressToInt: " + address + " -> " + Integer.toHexString(resp));
return( resp );
|
public static int | addressToInt(java.net.InetAddress i_address)
byte[] bytes = i_address.getAddress();
int resp = (bytes[0]<<24)&0xff000000 | (bytes[1] << 16)&0x00ff0000 | (bytes[2] << 8)&0x0000ff00 | bytes[3]&0x000000ff;
// System.out.println( "addressToInt: " + address + " -> " + Integer.toHexString(resp));
return( resp );
|
public static long | addressToLong(java.net.InetAddress i_address)
return(((long)addressToInt( i_address ))&0xffffffffL);
|
public static java.lang.String | intToAddress(int value)
byte[] bytes = { (byte)(value>>24), (byte)(value>>16),(byte)(value>>8),(byte)value };
try{
String res = InetAddress.getByAddress(bytes).getHostAddress();
// System.out.println( "intToAddress: " + Integer.toHexString(value) + " -> " + res );
return( res );
}catch( UnknownHostException e ){
// should never get here as always valid byte array (4 long)
Debug.printStackTrace(e);
return( null );
}
|