|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.faban.common.Utilities
public class Utilities
Common utilities, usually accessible via static import.
Field Summary | |
---|---|
static String |
masterFileSeparator
The file separator on the master. |
static String |
masterPathSeparator
The path separator on the master. |
Constructor Summary | |
---|---|
Utilities()
|
Method Summary | |
---|---|
static String |
convertPath(String path)
Attempts to convert a path from Windows to Unix. |
static String |
escapeXML(String message)
Formats the message to be XML compatible, with the XML escaping. |
static void |
escapeXML(String message,
StringBuilder msgBuffer)
Formats the message to be XML compatible, with the XML escaping. |
static File |
getJarFile(Class clazz)
Obtains the jar file that contains the class in question. |
static String |
getJavaHome()
Obtains the javaHome of the current JVM. |
static boolean |
isIpv4Address(String name)
Tests if a given host name is an ipv4 address. |
static String |
parseEscapedString(String s)
Parses a string escaped with \n, \t, \020, etc. |
static List<NameValuePair<Integer>> |
parseHostPorts(String hostPorts)
Parses the host:port string and puts the list of host:port pairs into a list. |
static String |
parseHostPorts(String hostPorts,
List<NameValuePair<Integer>> hostPortList,
Set<String> hostSet)
Parses the host:port string and puts the list of host:port pairs into the hostPortList. |
static int |
selectBucket(int current,
int total,
int buckets)
Simple, but frequently used utility function to determine which bucket or group the current value belongs to, providing the total and the number of buckets the values get divided into. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String masterFileSeparator
public static String masterPathSeparator
Constructor Detail |
---|
public Utilities()
Method Detail |
---|
public static String convertPath(String path)
path
- The path to convert
public static String parseEscapedString(String s)
s
- The string with backslashes
public static String getJavaHome()
public static File getJarFile(Class clazz)
clazz
- The given class
public static List<NameValuePair<Integer>> parseHostPorts(String hostPorts)
hostPorts
- The host:port string
public static String parseHostPorts(String hostPorts, List<NameValuePair<Integer>> hostPortList, Set<String> hostSet)
hostPorts
- The host:port stringhostPortList
- The list to insert the host:port pairshostSet
- The set to insert host names, null if not needed
public static int selectBucket(int current, int total, int buckets)
current
- The current valuetotal
- The total countbuckets
- The number of buckets to divide the set into.
public static String escapeXML(String message)
message
- The raw message
public static void escapeXML(String message, StringBuilder msgBuffer)
message
- The raw messagemsgBuffer
- The buffer to write the escaped stringpublic static boolean isIpv4Address(String name)
name
- The host name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |