java.lang.Object
com.ibm.jvm.format.Util
Provides various utility functions needed by the trace formatter
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intprotected static final BigIntegerprotected static final intprotected static final intprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final BigIntegerprotected static final String
- 
Method SummaryModifier and TypeMethodDescriptionprotected static final StringconstructString(byte[] data, int offset) Constructs a string from an array of bytes, encoding is as specified in the propertiesprotected static final StringconstructString(byte[] data, int offset, int count) Constructs a string from an array of bytes with a count, encoding is as specified in the propertiesprotected static final StringconstructString(byte[] data, int offset, int count, String enc) Constructs a string from an array of bytes with an offset and count, with the specified encoding (ASCII or EBCDIC).protected static final StringconstructString(byte[] data, int offset, String enc) Constructs a string from an array of bytes, with the specified encoding (ASCII or EBCDIC?)protected static final intconstructTraceID(byte[] data, int offset) protected static final intconstructUnsignedByte(byte[] data, int offset) protected static final longconstructUnsignedInt(byte[] data, int offset) protected static final BigIntegerconstructUnsignedLong(byte[] data, int offset) Construct a BigInteger from an array of bytes.protected static final BigIntegerconstructUnsignedLong(byte[] data, int offset, int numBytes) Construct a BigInteger from an array of bytes.protected static final StringconvertAndCheckEyecatcher(int eyecatcher) protected static final intconvertEndian(int in) static final StringescapeControlCharacters(String string) Escapes control characters in the given string.static final StringescapeControlCharacters(String string, String encoding) Escapes control characters in the given string.protected static final booleanfindComponentAndType(String comp, String type) determines if a particular component and type is to be formattedprotected static final booleanfindThreadID(Long threadID) retrieve whether of not the given id is in a hashtable.static final StringformatAsHexString(long number) Formats a number as a hex string, prefixing the "0x" radix specifier so that it can be unambiguously interpreted as a hex string.protected static final StringgetProperty(String key) gets an the value property that affecting behavior of the formatterprotected static final StringgetProperty(String key, String defaultValue) gets an the value property that affecting behavior of the formatter, if no such property is set the default value is returnedprotected static final voidInitializes static variables.protected static final voidpadBuffer(StringBuffer sb, int i, char c) protected static final voidpadBuffer(StringBuffer sb, int i, char c, boolean leftJustified) protected static final voidputComponent(String comp) puts a component name into a hashtable telling the formatter that this component is one that should be traced.protected static final voidputComponent(String comp, Vector types) puts a component name into a hashtable telling the formatter that this component is one that should be traced.protected static final voidputThreadID(Long threadID) puts a thread ID into a hashtable telling the formatter that this thread ID is one that should be tracedprotected static final voidsetBigEndian(boolean endian) protected static final voidsetProperty(String key, String val) sets an property that affects the behavior of the formatter
- 
Field Details- 
BYTEprotected static final int BYTE- See Also:
 
- 
INTprotected static final int INT- See Also:
 
- 
LONGprotected static final int LONG- See Also:
 
- 
SUM_TAB- See Also:
 
- 
MILLIS2SECONDS
- 
SECONDS2MINUTES
- 
MINUTES2HOURS
- 
HOURS2DAYS
- 
MILLION
 
- 
- 
Method Details- 
initStaticsprotected static final void initStatics()Initializes static variables.This is called each time the TraceFormatter is started, from the initStatics() method in TraceFormat.java 
- 
putThreadIDputs a thread ID into a hashtable telling the formatter that this thread ID is one that should be traced- Parameters:
- threadID- a string representation of a hexidecimal thread id
 
- 
findThreadIDretrieve whether of not the given id is in a hashtable. if the table is null that means that no ids were added, since the default behavior is all id this returns true- Parameters:
- threadID- a string representation of a hexidecimal thread id
- Returns:
- a boolean that is true if the id was added to the table or if the table is null
 
- 
putComponentputs a component name into a hashtable telling the formatter that this component is one that should be traced. In this case all types of entries are formatted for this component- Parameters:
- comp- a string representation of a component in the jvm
 
- 
putComponentputs a component name into a hashtable telling the formatter that this component is one that should be traced. In this case only the types of entries specified in types are formatted for this component- Parameters:
- comp- a string representation of a component in the jvm
- types- a vector of string for the type of trace entries to format (ie, Entry, Exit, Exception, etc)
 
- 
findComponentAndTypedetermines if a particular component and type is to be formatted- Parameters:
- comp- a string representation of a component in the jvm
- types- a string for the type of trace entry to format (ie, Entry, Exit, Exception, etc)
- Returns:
- a boolean that is true if this component and type was added to the table or if the table is null
 
- 
constructUnsignedLongConstruct a BigInteger from an array of bytes. BigIntegers are used to get around problems caused by the lack of unsigned primitive type.- Parameters:
- data- an array of bytes
- offset- offset to the first byte to use to create the BigInteger
- Returns:
- a positive BigInteger constructed from the byte array
 
- 
constructUnsignedLongConstruct a BigInteger from an array of bytes. BigIntegers are used to get around problems caused by the lack of unsigned primitive type.- Parameters:
- data- an array of bytes
- offset- offset to the first byte to use to create the BigInteger
- numBytes- the length of this BigInteger in bytes
- Returns:
- a positive BigInteger constructed from the byte array
 
- 
constructTraceIDprotected static final int constructTraceID(byte[] data, int offset) 
- 
constructUnsignedIntprotected static final long constructUnsignedInt(byte[] data, int offset) 
- 
constructUnsignedByteprotected static final int constructUnsignedByte(byte[] data, int offset) 
- 
constructStringConstructs a string from an array of bytes, encoding is as specified in the properties
- 
constructStringConstructs a string from an array of bytes, with the specified encoding (ASCII or EBCDIC?)
- 
constructStringConstructs a string from an array of bytes with a count, encoding is as specified in the properties
- 
escapeControlCharactersEscapes control characters in the given string.- Parameters:
- string-
 
- 
escapeControlCharactersEscapes control characters in the given string.- Parameters:
- string-
- encoding-
 
- 
constructStringConstructs a string from an array of bytes with an offset and count, with the specified encoding (ASCII or EBCDIC).
- 
setPropertysets an property that affects the behavior of the formatter- Parameters:
- key-
- val-
 
- 
getPropertygets an the value property that affecting behavior of the formatter- Parameters:
- key-
- Returns:
- a string
 
- 
getPropertygets an the value property that affecting behavior of the formatter, if no such property is set the default value is returned- Parameters:
- key-
- defaultValue-
- Returns:
- a string
 
- 
padBuffer
- 
padBuffer
- 
formatAsHexStringFormats a number as a hex string, prefixing the "0x" radix specifier so that it can be unambiguously interpreted as a hex string.- Parameters:
- number- the number to format
 
- 
convertEndianprotected static final int convertEndian(int in) 
- 
convertAndCheckEyecatcher
- 
setBigEndianprotected static final void setBigEndian(boolean endian) 
 
-