All Downloads are FREE. Search and download functionalities are using the official Maven repository.

alice.util.IPAddress Maven / Gradle / Ivy

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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy