public class DataFormatHelper
extends java.lang.Object
Constructor and Description |
---|
DataFormatHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
escape(java.lang.String src)
Escapes characters in the input string that would interfere with formatting
|
static java.lang.String |
formatCurrentTime()
Return the current time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z
|
static java.lang.String |
formatTime(long timestamp)
Return the given time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z
|
static java.lang.String |
getThreadId()
Get and return the thread id, padded to 8 characters.
|
static java.lang.String |
getThreadId(java.lang.Thread thread)
Get and return the thread id, padded to 8 characters.
|
static java.lang.String |
identityToString(java.lang.Object o)
Returns a string containing a concise, human-readable description of the
object.
|
static java.lang.String |
padHexString(int num,
int width)
Returns the provided integer, padded to the specified number of characters with zeros.
|
static java.lang.String |
sensitiveToString(java.lang.Object o)
Returns a string containing a concise, human-readable description of the
object.
|
static java.lang.String |
throwableToString(java.lang.Throwable t)
Returns a string containing the formatted exception stack
|
public static java.lang.String identityToString(java.lang.Object o)
o
- the objectpublic static java.lang.String sensitiveToString(java.lang.Object o)
identityToString(java.lang.Object)
but indicates
that the contents of the object are masked because they are sensitive.o
- the objectpublic static final java.lang.String formatCurrentTime()
public static final java.lang.String formatTime(long timestamp)
timestamp
- A timestamp as a long, e.g. what would be returned from
System.currentTimeMillis()
public static final java.lang.String getThreadId()
public static final java.lang.String getThreadId(java.lang.Thread thread)
thread
- the specified threadpublic static final java.lang.String padHexString(int num, int width)
num
- Input number as an integerwidth
- Number of characters to return, including paddingpublic static final java.lang.String throwableToString(java.lang.Throwable t)
t
- throwablepublic static final java.lang.String escape(java.lang.String src)
src
- input string to be escaped