com.unboundid.scim.sdk
Class StaticUtils

java.lang.Object
  extended by com.unboundid.scim.sdk.StaticUtils

public final class StaticUtils
extends Object

This class provides a number of static utility functions.


Method Summary
static int exec(String command, String[] args, File workingDirectory, Map<String,String> environment, List<String> output)
          Executes the specified command on the system and captures its output.
static String getStackTrace(StackTraceElement[] elements)
          Returns a single-line string representation of the stack trace.
static void getStackTrace(StackTraceElement[] elements, StringBuilder buffer)
          Appends a single-line string representation of the stack trace to the given buffer.
static String getStackTrace(Throwable t)
          Retrieves a single-line string representation of the stack trace for the provided Throwable.
static void getStackTrace(Throwable t, StringBuilder buffer)
          Appends a single-line string representation of the stack trace for the provided Throwable to the given buffer.
static String toLowerCase(String s)
          Retrieves an all-lowercase version of the provided string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toLowerCase

public static String toLowerCase(String s)
Retrieves an all-lowercase version of the provided string.

Parameters:
s - The string for which to retrieve the lowercase version.
Returns:
An all-lowercase version of the provided string.

getStackTrace

public static String getStackTrace(Throwable t)
Retrieves a single-line string representation of the stack trace for the provided Throwable. It will include the unqualified name of the Throwable class, a list of source files and line numbers (if available) for the stack trace, and will also include the stack trace for the cause (if present).

Parameters:
t - The Throwable for which to retrieve the stack trace.
Returns:
A single-line string representation of the stack trace for the provided Throwable.

getStackTrace

public static void getStackTrace(Throwable t,
                                 StringBuilder buffer)
Appends a single-line string representation of the stack trace for the provided Throwable to the given buffer. It will include the unqualified name of the Throwable class, a list of source files and line numbers (if available) for the stack trace, and will also include the stack trace for the cause (if present).

Parameters:
t - The Throwable for which to retrieve the stack trace.
buffer - The buffer to which the information should be appended.

getStackTrace

public static String getStackTrace(StackTraceElement[] elements)
Returns a single-line string representation of the stack trace. It will include a list of source files and line numbers (if available) for the stack trace.

Parameters:
elements - The stack trace.
Returns:
A single-line string representation of the stack trace.

getStackTrace

public static void getStackTrace(StackTraceElement[] elements,
                                 StringBuilder buffer)
Appends a single-line string representation of the stack trace to the given buffer. It will include a list of source files and line numbers (if available) for the stack trace.

Parameters:
elements - The stack trace.
buffer - The buffer to which the information should be appended.

exec

public static int exec(String command,
                       String[] args,
                       File workingDirectory,
                       Map<String,String> environment,
                       List<String> output)
                throws IOException,
                       SecurityException,
                       InterruptedException
Executes the specified command on the system and captures its output. This will not return until the specified process has completed.

Parameters:
command - The command to execute.
args - The set of arguments to provide to the command.
workingDirectory - The working directory to use for the command, or null if the default directory should be used.
environment - The set of environment variables that should be set when executing the command, or null if none are needed.
output - The output generated by the command while it was running. This will include both standard output and standard error. It may be null if the output does not need to be captured.
Returns:
The exit code for the command.
Throws:
IOException - If an I/O problem occurs while trying to execute the command.
SecurityException - If the security policy will not allow the command to be executed.
InterruptedException - If the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.


Copyright © 2011-2012 UnboundID. All Rights Reserved.