public class ConfigUtil extends Object
ConfigurationFile
Modifier and Type | Method and Description |
---|---|
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. |
public static String concat(Object[] objects)
String.valueOf(Object)
on each element of
an array of objects. Passing a zero length array will result in
the empty string being returned.objects
- the array of objects to be processed.String.valueOf
on each element of
objects
.NullPointerException
- if objects
is null
.public static String getHostName() throws UnknownHostException
UnknownHostException
- if no IP address for the local
host could be found.public static String getHostAddress() throws UnknownHostException
UnknownHostException
- if no IP address for the local
host could be found.public static String stringLiteral(String string)
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.string
- the string to turn into a string literalString
that if parsed as sequence of
of characters by ConfigurationFile
would
yield a String
equivalent to string
NullPointerException
- if string
is
null
public static ServiceID createServiceID(String s)
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.s
- the string representation to create the ServiceID
withServiceID
with the value represented by the
given stringIllegalArgumentException
- if the supplied string
representation does not conform to the specified formatNullPointerException
- if s
is
null
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.