public final class StaticUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
collectionToString(Collection<?> collection,
String separator)
Creates a string representation of the elements in the
collection separated by separator. |
static Throwable |
getRootCause(Throwable t)
Inspects the Throwable to obtain the root cause.
|
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 byte[] |
getUTF8Bytes(String s)
Retrieves a UTF-8 byte representation of the provided string.
|
static String |
listToString(List<?> list,
String separator)
Creates a string representation of the elements in the
list separated by separator. |
static String |
toLowerCase(String s)
Retrieves an all-lowercase version of the provided string.
|
public static String toLowerCase(String s)
s - The string for which to retrieve the lowercase version.public static String listToString(List<?> list, String separator)
list separated by separator.list - the list to printseparator - to use between elementspublic static String collectionToString(Collection<?> collection, String separator)
collection separated by separator.collection - to printseparator - to use between elementspublic static byte[] getUTF8Bytes(String s)
s - The string for which to retrieve the UTF-8 byte representation.public static String getStackTrace(Throwable t)
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).t - The Throwable for which to retrieve the stack trace.Throwable.public static void getStackTrace(Throwable t, StringBuilder buffer)
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).t - The Throwable for which to retrieve the stack
trace.buffer - The buffer to which the information should be appended.public static String getStackTrace(StackTraceElement[] elements)
elements - The stack trace.public static void getStackTrace(StackTraceElement[] elements, StringBuilder buffer)
elements - The stack trace.buffer - The buffer to which the information should be appended.public static Throwable getRootCause(Throwable t)
This method handles recursive cause structures that
might otherwise cause infinite loops. If the Throwable parameter has a
cause of itself, then a reference to itself will be returned.
If the cause chain loops, the last element in the chain before
it loops is returned.
t - the Throwable to get the root cause for. This may be null.Copyright © 2011–2016 UnboundID. All rights reserved.