| java.lang.Object org.lateralnz.common.util.SystemUtils
SystemUtils | public class SystemUtils (Code) | | various 'System' related functions
author: J R Briggs |
Inner Class :static class ProcessMonitor extends Thread | |
Method Summary | |
final public static void | copyFile(String f1, String f2) | final public static String[] | exec(String[] cmd, String[] env, File f, long waitPeriod) execute a given command. | final public static String | getArgument(String[] args, int idx, String defaultValue) | final public static String[] | getFileList(String directory, String regex) | final public static void | getFileList(List filelist, String directory, String includesRegex, String excludesRegex, boolean recursive) | final public static byte[] | getLocalhostIP() hopefully this will return the 'real' IP address even if the hosts file is configured
incorrectly (as I discovered on my test machine... | final public static Method | getSetterMethod(Class c, String property, Class[] paramTypes) | final public static Object | invoke(Object obj, String method, Object[] args) | final public static void | invokeMain(Class c, String[] args) | final public static void | sleep(long time) |
exec | final public static String[] exec(String[] cmd, String[] env, File f, long waitPeriod) throws IOException, InterruptedException(Code) | | execute a given command. This essentially wraps the command with a monitor so we can
kill it after a certain period of time. At the moment this is useful for Jikes, since it
seems to hang after certain errors, with no meaningful syserr output
Parameters: cmd - the command array Parameters: env - the environment array Parameters: f - the file to use during the exec (@see java.lang.Runtime#getRuntime) Parameters: waitPeriod - the length of time to wait until we assume something has gone wrong and kill the process |
getArgument | final public static String getArgument(String[] args, int idx, String defaultValue)(Code) | | taking an array of arguments (usually in the main() method) return the value at
a particular index -- or if it is null/empty, return a default value
|
getFileList | final public static String[] getFileList(String directory, String regex)(Code) | | get a list of files matching a regex
|
getFileList | final public static void getFileList(List filelist, String directory, String includesRegex, String excludesRegex, boolean recursive)(Code) | | loads the specified list with File objects (recursing through directories if required)
|
getLocalhostIP | final public static byte[] getLocalhostIP()(Code) | | hopefully this will return the 'real' IP address even if the hosts file is configured
incorrectly (as I discovered on my test machine... JRB). However, If it really can't
figure out the address it will return the loopback address.
|
sleep | final public static void sleep(long time)(Code) | | |
|
|