GigaSpaces XAP 8.0 API

com.sun.jini.config
Class ConfigUtil

java.lang.Object
  extended by com.sun.jini.config.ConfigUtil

public class ConfigUtil
extends Object

A set of static convenience methods for use in configuration files. This class cannot be instantiated.

Since:
2.0
Author:
Sun Microsystems, Inc.
See Also:
ConfigurationFile

Method Summary
static String concat(Object[] objects)
          Concatenate the strings resulting from calling String.valueOf(Object) on each element of an array of objects.
static ServiceID createServiceID(String s)
          Returns a ServiceID constructed from a 128-bit value represented by a string.
static String getHostAddress()
          Returns the textual presentation of the local host IP address.
static String getHostName()
          Return the local hostname.
static String stringLiteral(String string)
          Returns a String whose characters, if parsed by a ConfigurationFile, would yield a String equivalent to the passed argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

concat

public static String concat(Object[] objects)
Concatenate the strings resulting from calling String.valueOf(Object) on each element of an array of objects. Passing a zero length array will result in the empty string being returned.

Parameters:
objects - the array of objects to be processed.
Returns:
the concatenation of the return values from calling String.valueOf on each element of objects.
Throws:
NullPointerException - if objects is null.

getHostName

public static String getHostName()
                          throws UnknownHostException
Return the local hostname.

Returns:
the local hostname.
Throws:
UnknownHostException - if no IP address for the local host could be found.

getHostAddress

public static String getHostAddress()
                             throws UnknownHostException
Returns the textual presentation of the local host IP address.

Returns:
the textual presentation of the local host IP address.
Throws:
UnknownHostException - if no IP address for the local host could be found.

stringLiteral

public static String stringLiteral(String string)
Returns a String whose characters, if parsed by a ConfigurationFile, would yield a String equivalent to the passed argument. This is done by replacing CR and LF with their escape codes, quoting '\' and '"' with '\', and enclosing the entire sequence in double quotes. Additionally the tab, form feed, and backspace characters will be converted to their escape codes and other control characters (besides CR and LF) to octal escapes for better readability if the string is printed for debugging purposes.

Parameters:
string - the string to turn into a string literal
Returns:
a String that if parsed as sequence of of characters by ConfigurationFile would yield a String equivalent to string
Throws:
NullPointerException - if string is null

createServiceID

public static ServiceID createServiceID(String s)
Returns a ServiceID constructed from a 128-bit value represented by a string. The supplied string representation must be in the format defined by ServiceID.toString, except that uppercase hexadecimal digits are allowed.

Parameters:
s - the string representation to create the ServiceID with
Returns:
a ServiceID with the value represented by the given string
Throws:
IllegalArgumentException - if the supplied string representation does not conform to the specified format
NullPointerException - if s is null

GigaSpaces XAP 8.0 API

Copyright © GigaSpaces.