alice.util.IPAddress Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tuprolog Show documentation
Show all versions of tuprolog Show documentation
Light-weight Prolog system for Internet applications and infrastructures
The newest version!
/*
* IPAddress.java
*
* Copyright 2000-2001-2002 aliCE team at deis.unibo.it
*
* This software is the proprietary information of deis.unibo.it
* Use is subject to license terms.
*
*/
package alice.util;
/**
* this class defines services useful for
* managing of IP extended address:
*
* :
*
*/
public class IPAddress extends Object {
static public int getPort(String address){
int index=address.indexOf(':');
if (index!=-1){
try {
return Integer.parseInt(address.substring(index+1,address.length()));
} catch (Exception ex){
}
}
return -1;
}
static public String getHost(String address){
int index=address.indexOf(':');
if (index!=-1){
return address.substring(0,index);
}
return address;
}
}