com.ibm.ras
Class RASUtil

java.lang.Object
  |
  +--com.ibm.ras.RASUtil

public class RASUtil
extends java.lang.Object

RASUtil contains utility methods used by the RAS Toolkit.


Field Summary
static java.lang.String RAS_MSG_CAT
          The name of the catalog containing RAS messages.
static RASMessageCatalog rasMsgs
          The catalog containing RAS messages and strings to be displayed.
 
Constructor Summary
RASUtil()
           
 
Method Summary
static java.util.Vector arrayToVector(java.lang.Object[] array)
          Converts an array to a Vector.
static java.lang.Object[] checkNullObjects(java.lang.Object[] inserts)
          Checks the array of inserts for null objects and inserts a string in the place of each such object.
static java.lang.Object createObject(java.lang.String name)
          Creates an Object from its class name.
static void errorMsg(java.lang.String msg)
          Writes a message to System.err.
static java.lang.String getConsoleCodePage()
          Gets the code page to use when writing to the console.
static java.lang.String left(java.lang.String input, int length)
          Returns a string containing the left-most length characters of input.
static java.lang.String left(java.lang.String input, int length, java.lang.String pad)
          Returns a string containing the left-most length characters of input.
static boolean makePath(java.lang.String fileName)
          Creates the parent directories of a file.
static java.util.Vector stringToVector(java.lang.String source)
          Converts a String of blank-delimited strings to a Vector of Strings.
static java.lang.String vectorToString(java.util.Vector source)
          Converts a Vector of Strings to a single line with elements separated by a single blank.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RAS_MSG_CAT

public static final java.lang.String RAS_MSG_CAT
The name of the catalog containing RAS messages.

rasMsgs

public static RASMessageCatalog rasMsgs
The catalog containing RAS messages and strings to be displayed.
Constructor Detail

RASUtil

public RASUtil()
Method Detail

checkNullObjects

public static java.lang.Object[] checkNullObjects(java.lang.Object[] inserts)
Checks the array of inserts for null objects and inserts a string in the place of each such object.
Parameters:
inserts - The array of inserts to be checked.
Returns:
The same array, updated to remove null objects.

createObject

public static java.lang.Object createObject(java.lang.String name)
Creates an Object from its class name.
Parameters:
name - The fully-qualified name of the object.
Returns:
The object, or null if the requested object could not be created.

errorMsg

public static void errorMsg(java.lang.String msg)
Writes a message to System.err. This method compensates for a Java bug (4038677) which displays non-ISO Latin/1 characters in the wrong code page.
Parameters:
msg - The message to be written to System.err.

getConsoleCodePage

public static java.lang.String getConsoleCodePage()
Gets the code page to use when writing to the console. On Windows platforms, because of a Java bug (4038677), the non-ISO Latin/1 characters are displayed in the wrong code page. The problem only appears in single-byte character sets. The bypass is to specify the correct code page.
Returns:
The proper code page for writing to the console, based on the default locale, or null if the default code page is correct.

left

public static java.lang.String left(java.lang.String input,
                                    int length,
                                    java.lang.String pad)
Returns a string containing the left-most length characters of input. The string is padded with pad characters, or truncated as needed.
Parameters:
input - The string to be padded or truncated.
length - The length of the final string.
pad - The character to be used for padding the string
Returns:
The altered string.

left

public static java.lang.String left(java.lang.String input,
                                    int length)
Returns a string containing the left-most length characters of input. The string is padded with blanks, or truncated as needed.
Parameters:
input - The string to be padded or truncated.
length - The length of the final string.
Returns:
The altered string.

makePath

public static boolean makePath(java.lang.String fileName)
                        throws java.lang.SecurityException
Creates the parent directories of a file. The path separator may be a front-slash ('/') or the platform-specific path separator character. For example:
 /Dir1/Dir2/Dir3/MyStuff.log 
 
Parameters:
fileName - The name of the file whose path is to be created.
Returns:
true if the patch was created or false,
Throws:
java.lang.SecurityException - This runtime exception is thrown if a security manager is installed and a security violation is detected.

arrayToVector

public static java.util.Vector arrayToVector(java.lang.Object[] array)
Converts an array to a Vector. This method is useful in logging a Vector because Vector.toString displays information on each of the object's elements, where toString on an array does not.
Parameters:
array - The source array to convert.
Returns:
The Vector equivalent or null if the source array is null.

stringToVector

public static java.util.Vector stringToVector(java.lang.String source)
Converts a String of blank-delimited strings to a Vector of Strings.
Parameters:
source - The source String to convert.
Returns:
The Vector equivalent or null if the source String is null.

vectorToString

public static java.lang.String vectorToString(java.util.Vector source)
Converts a Vector of Strings to a single line with elements separated by a single blank.
Parameters:
source - The source Vector of Strings to convert.
Returns:
The String equivalent or null if the source Vector is null.