Class Util
java.lang.Object
com.ibm.jvm.format.Util
Provides various utility functions needed by the trace formatter
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final BigInteger
protected static final int
protected static final int
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final String
-
Method Summary
Modifier and TypeMethodDescriptionprotected static final String
constructString
(byte[] data, int offset) Constructs a string from an array of bytes, encoding is as specified in the propertiesprotected static final String
constructString
(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 String
constructString
(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 String
constructString
(byte[] data, int offset, String enc) Constructs a string from an array of bytes, with the specified encoding (ASCII or EBCDIC?)protected static final int
constructTraceID
(byte[] data, int offset) protected static final int
constructUnsignedByte
(byte[] data, int offset) protected static final long
constructUnsignedInt
(byte[] data, int offset) protected static final BigInteger
constructUnsignedLong
(byte[] data, int offset) Construct a BigInteger from an array of bytes.protected static final BigInteger
constructUnsignedLong
(byte[] data, int offset, int numBytes) Construct a BigInteger from an array of bytes.protected static final String
convertAndCheckEyecatcher
(int eyecatcher) protected static final int
convertEndian
(int in) static final String
escapeControlCharacters
(String string) Escapes control characters in the given string.static final String
escapeControlCharacters
(String string, String encoding) Escapes control characters in the given string.protected static final boolean
findComponentAndType
(String comp, String type) determines if a particular component and type is to be formattedprotected static final boolean
findThreadID
(Long threadID) retrieve whether of not the given id is in a hashtable.static final String
formatAsHexString
(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 String
getProperty
(String key) gets an the value property that affecting behavior of the formatterprotected static final String
getProperty
(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 void
Initializes static variables.protected static final void
padBuffer
(StringBuffer sb, int i, char c) protected static final void
padBuffer
(StringBuffer sb, int i, char c, boolean leftJustified) protected static final void
putComponent
(String comp) puts a component name into a hashtable telling the formatter that this component is one that should be traced.protected static final void
putComponent
(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 void
putThreadID
(Long threadID) puts a thread ID into a hashtable telling the formatter that this thread ID is one that should be tracedprotected static final void
setBigEndian
(boolean endian) protected static final void
setProperty
(String key, String val) sets an property that affects the behavior of the formatter
-
Field Details
-
BYTE
protected static final int BYTE- See Also:
-
INT
protected static final int INT- See Also:
-
LONG
protected static final int LONG- See Also:
-
SUM_TAB
- See Also:
-
MILLIS2SECONDS
-
SECONDS2MINUTES
-
MINUTES2HOURS
-
HOURS2DAYS
-
MILLION
-
-
Method Details
-
initStatics
protected static final void initStatics()Initializes static variables.This is called each time the TraceFormatter is started, from the initStatics() method in TraceFormat.java
-
putThreadID
puts 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
-
findThreadID
retrieve 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
-
putComponent
puts 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
-
putComponent
puts 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 jvmtypes
- a vector of string for the type of trace entries to format (ie, Entry, Exit, Exception, etc)
-
findComponentAndType
determines if a particular component and type is to be formatted- Parameters:
comp
- a string representation of a component in the jvmtypes
- 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
-
constructUnsignedLong
Construct 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 bytesoffset
- offset to the first byte to use to create the BigInteger- Returns:
- a positive BigInteger constructed from the byte array
-
constructUnsignedLong
Construct 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 bytesoffset
- offset to the first byte to use to create the BigIntegernumBytes
- the length of this BigInteger in bytes- Returns:
- a positive BigInteger constructed from the byte array
-
constructTraceID
protected static final int constructTraceID(byte[] data, int offset) -
constructUnsignedInt
protected static final long constructUnsignedInt(byte[] data, int offset) -
constructUnsignedByte
protected static final int constructUnsignedByte(byte[] data, int offset) -
constructString
Constructs a string from an array of bytes, encoding is as specified in the properties -
constructString
-
constructString
Constructs a string from an array of bytes with a count, encoding is as specified in the properties -
escapeControlCharacters
-
escapeControlCharacters
-
constructString
-
setProperty
-
getProperty
-
getProperty
-
padBuffer
-
padBuffer
-
formatAsHexString
Formats 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
-
convertEndian
protected static final int convertEndian(int in) -
convertAndCheckEyecatcher
-
setBigEndian
protected static final void setBigEndian(boolean endian)
-