springs.util
Class Utilities

java.lang.Object
  |
  +--springs.util.Utilities

public class Utilities
extends java.lang.Object

A class with utilities.

Author:
Sergio Ilarri Artigas

Field Summary
static java.util.Vector LOCAL_IPs
           
 
Constructor Summary
Utilities()
           
 
Method Summary
static void block()
          Blocks the caller forever.
static java.lang.String getAsString(java.util.Set strings)
          Gets a string representing the set.
static java.lang.String getAsString(java.util.Vector strings)
          Gets a string representing the vector.
static java.net.InetAddress getLocalIPAddress()
          Gets the local IP address.
static java.util.Vector getLocalIPAddresses()
          Gets all the local IP addresses.
static java.lang.String getOneNameForLocalhost()
          Gets the name of the localhost computer (one of the possible, if several).
static java.lang.String getTimeString(long milliseconds)
          Gets a string representing the time for the given milliseconds.
static void print(java.lang.String line)
          Prints the given line.
static void print(java.lang.String line, boolean print)
          Prints the given line on condition that the boolean parameter is true.
private static java.net.InetAddress selectIP(java.util.Vector ips)
          Selects an IP address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_IPs

public static java.util.Vector LOCAL_IPs
Constructor Detail

Utilities

public Utilities()
Method Detail

block

public static void block()
Blocks the caller forever.


print

public static void print(java.lang.String line)
Prints the given line.


print

public static void print(java.lang.String line,
                         boolean print)
Prints the given line on condition that the boolean parameter is true.

Parameters:
print - a parameter indicating whether the given line should be printed or not.

getTimeString

public static java.lang.String getTimeString(long milliseconds)
Gets a string representing the time for the given milliseconds.

Parameters:
milliseconds - the milliseconds.
Returns:
the string.
See Also:
String

getAsString

public static java.lang.String getAsString(java.util.Vector strings)
Gets a string representing the vector.

Parameters:
strings - the vector of strings.
Returns:
the string.
See Also:
String

getAsString

public static java.lang.String getAsString(java.util.Set strings)
Gets a string representing the set.

Parameters:
strings - the set of strings.
Returns:
the string.
See Also:
Set

getOneNameForLocalhost

public static java.lang.String getOneNameForLocalhost()
Gets the name of the localhost computer (one of the possible, if several).

Returns:
the name of the localhost computer.
See Also:
String

getLocalIPAddress

public static java.net.InetAddress getLocalIPAddress()
Gets the local IP address.

Returns:
the local inet address.
See Also:
InetAddress

selectIP

private static java.net.InetAddress selectIP(java.util.Vector ips)
Selects an IP address. In this implementation, the first IP address is simply returned. More elaborate implementations could show a dialog to the user.

Parameters:
ips - the vector of IP addresses (of class InetAddress).
See Also:
InetAddress

getLocalIPAddresses

public static java.util.Vector getLocalIPAddresses()
Gets all the local IP addresses.

Returns:
a vector with the local IPs.
See Also:
Vector, InetAddress