info.informatica.net
Class InetUtil

java.lang.Object
  extended by info.informatica.net.InetUtil

public class InetUtil
extends Object

Utility class with commonly-used network functions.

Version:
1.02
Author:
amengual at informatica dot info

Constructor Summary
InetUtil()
           
 
Method Summary
static String getUriFromUrl(String url)
          Gets the file from a URL.
static boolean isInetAddress(String ipOrName)
          Performs a relaxed check to see if something is either a hostname or an IPv4 address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InetUtil

public InetUtil()
Method Detail

isInetAddress

public static boolean isInetAddress(String ipOrName)
Performs a relaxed check to see if something is either a hostname or an IPv4 address.

Parameters:
ipOrName - the candidate hostname or IPv4 address
Returns:
false if the argument cannot be an IPv4 address, true otherwise

getUriFromUrl

public static String getUriFromUrl(String url)
Gets the file from a URL. Similar to URL.getFile(), but avoids overhead.

Parameters:
url - a String representing the URL to extract the file from
Returns:
a String with the file URI, or null if not recognized as URL or there is no URI part on it