com.ibm.websphere.ras

Class DataFormatHelper

  1. java.lang.Object
  2. extended bycom.ibm.websphere.ras.DataFormatHelper

  1. public class DataFormatHelper
  2. extends java.lang.Object
Utilities which provide formatting for date strings (NCSA compliant dates used in trace records), and padded thread ids, etc.

Constructor Summary

Constructor and Description
DataFormatHelper()

Method Summary

Modifier and Type Method and Description
  1. static
  2. java.lang.String
escape(java.lang.String src)
Escapes characters in the input string that would interfere with formatting
  1. static
  2. java.lang.String
formatCurrentTime()
Return the current time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z
  1. static
  2. java.lang.String
formatTime(long timestamp)
Return the given time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z
  1. static
  2. java.lang.String
getThreadId()
Get and return the thread id, padded to 8 characters.
  1. static
  2. java.lang.String
padHexString(int num,int width)
Returns the provided integer, padded to the specified number of characters with zeros.
  1. static
  2. java.lang.String
throwableToString(java.lang.Throwable t)
Returns a string containing the formatted exception stack
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DataFormatHelper

  1. public DataFormatHelper()

Method Detail

formatCurrentTime

  1. public static final java.lang.String formatCurrentTime( )
Return the current time formatted as dd/MMM/yyyy HH:mm:ss:SSS Z
Returns:
formated date string

formatTime

  1. public static final java.lang.String formatTime( long timestamp)
Return 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

getThreadId

  1. public static final java.lang.String getThreadId( )
Get and return the thread id, padded to 8 characters.
Returns:
8 character string representation of thread id

padHexString

  1. public static final java.lang.String padHexString( int num,
  2. int width)
Returns 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

throwableToString

  1. public static final java.lang.String throwableToString( java.lang.Throwable t)
Returns a string containing the formatted exception stack
Parameters:
t - throwable
Returns:
formatted exception stack as a string

escape

  1. public static final java.lang.String escape( java.lang.String src)
Escapes characters in the input string that would interfere with formatting
Parameters:
src - input string to be escaped
Returns:
escaped string