Package com.ibm.websphere.ras
Class DataFormatHelper
java.lang.Object
com.ibm.websphere.ras.DataFormatHelper
Utilities which provide formatting for date strings (NCSA compliant dates
 used in trace records), and padded thread ids, etc.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic final StringEscapes characters in the input string that would interfere with formattingstatic final StringReturn the current time formatted as dd/MMM/yyyy HH:mm:ss:SSS Zstatic final StringformatTime(long timestamp) Return the given time formatted as dd/MMM/yyyy HH:mm:ss:SSS Zstatic final StringformatTime(long timestamp, boolean useIsoDateFormat) Return the given time formatted, based on the provided format structurestatic final StringGet and return the thread id, padded to 8 characters.static final StringgetThreadId(Thread thread) Get and return the thread id, padded to 8 characters.static StringReturns a string containing a concise, human-readable description of the object.static final StringpadHexString(int num, int width) Returns the provided integer, padded to the specified number of characters with zeros.static StringReturns a string containing a concise, human-readable description of the object.static final StringReturns a string containing the formatted exception stack
- 
Constructor Details- 
DataFormatHelperpublic DataFormatHelper()
 
- 
- 
Method Details- 
identityToStringReturns a string containing a concise, human-readable description of the object. The string is the same as the one that would be returned by Object.toString even if the object's class has overriden the toString or hashCode methods. The return value for a null object is null.- Parameters:
- o- the object
- Returns:
- the string representation
 
- 
sensitiveToStringReturns a string containing a concise, human-readable description of the object. The result is similar toidentityToString(java.lang.Object)but indicates that the contents of the object are masked because they are sensitive.- Parameters:
- o- the object
- Returns:
- a string representation
 
- 
formatCurrentTimeReturn the current time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z- Returns:
- formated date string
 
- 
formatTimeReturn the given time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z- Parameters:
- timestamp- A timestamp as a long, e.g. what would be returned from- System.currentTimeMillis()
- Returns:
- formated date string
 
- 
formatTimeReturn the given time formatted, based on the provided format structure- Parameters:
- timestamp- A timestamp as a long, e.g. what would be returned from- System.currentTimeMillis()
- useIsoDateFormat- A boolean, if true, the given date and time will be formatted in ISO-8601, e.g. yyyy-MM-dd'T'HH:mm:ss.SSSZ if false, the date and time will be formatted as the current locale,
- Returns:
- formated date string
 
- 
getThreadIdGet and return the thread id, padded to 8 characters.- Returns:
- 8 character string representation of thread id
 
- 
getThreadIdGet and return the thread id, padded to 8 characters.- Parameters:
- thread- the specified thread
- Returns:
- the string representation of the thread id
 
- 
padHexStringReturns the provided integer, padded to the specified number of characters with zeros.- Parameters:
- num- Input number as an integer
- width- Number of characters to return, including padding
- Returns:
- input number as zero-padded string
 
- 
throwableToStringReturns a string containing the formatted exception stack- Parameters:
- t- throwable
- Returns:
- formatted exception stack as a string
 
- 
escapeEscapes characters in the input string that would interfere with formatting- Parameters:
- src- input string to be escaped
- Returns:
- escaped string
 
 
-