jrunx.iiop.security
Class TypeUtil

java.lang.Object
  |
  +--jrunx.iiop.security.TypeUtil

public class TypeUtil
extends java.lang.Object

Datatype management utility methods


Constructor Summary
TypeUtil()
           
 
Method Summary
static java.lang.String addCommas(float f)
          Deprecated. Use standard java.* APIs which create the correct localized number format.
static java.lang.String addCommas(java.lang.String numStr)
          Deprecated. Use standard java.* APIs which create the correct localized number format.
static java.lang.String arrayToString(java.lang.String[] from, java.lang.String separator)
          Convert an array of strings to a single line with elements separated by the given separator.
static java.lang.reflect.Method getMethod(java.lang.Class declaringClass, java.lang.ClassLoader loader, java.lang.String name, java.lang.String[] paramClassNames)
           
static java.util.Set getSuperInterfaces(java.lang.ClassLoader cl, java.lang.String className, java.lang.String baseClassName)
          Get all super-interfaces of a class, excluding the given base interface.
static int hashCode(java.lang.String s)
          Work around a performance bug in String.hashCode() for strings longer than sixteen characters, by calculating a (slower) hash on all the characters in the string.
static int intGetBytes(int src, byte[] buf, int offset)
          Place a byte representation of src into the byte array buf.
static int intGetChars(int src, char[] buf, int offset)
          Place a character representation of src into the buffer.
static boolean isSubclassOf(java.lang.Class sub, java.lang.Class sup)
          Deprecated. Use sup.isAssignableFrom(sub)
static java.lang.String[] stringToArray(java.lang.String from, java.lang.String separator)
          Convert a string of delimited strings to an array of strings.
static java.lang.String truncateFloat(float f, int digits)
          Truncate a float to the required number of significant digits.
static java.lang.String[] wordWrap(java.lang.String msg, int widthInChars)
          Word-wrap a string into an array of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeUtil

public TypeUtil()
Method Detail

intGetChars

public static int intGetChars(int src,
                              char[] buf,
                              int offset)
Place a character representation of src into the buffer. No formatting (e.g. localization) is done.
Parameters:
src - - the integer to convert. Must not be Integer.MIN_VALUE.
buf - - the buf to put the result in
offset - - the offset in buf to place the first digit
Returns:
the number of bytes added to buf
Throws:
java.lang.IllegalArgumentException - if src is Integer.MIN_VALUE.

intGetBytes

public static int intGetBytes(int src,
                              byte[] buf,
                              int offset)
Place a byte representation of src into the byte array buf. No commas or any other formatting is done to the integer.
Parameters:
src - - the integer to convert. Must not be Integer.MIN_VALUE.
buf - - the buf to put the result in
offset - - the offset in buf to place the first digit
Returns:
the number of bytes added to buf
Throws:
java.lang.IllegalArgumentException - if src is Integer.MIN_VALUE.

hashCode

public static int hashCode(java.lang.String s)
Work around a performance bug in String.hashCode() for strings longer than sixteen characters, by calculating a (slower) hash on all the characters in the string. Not needed starting in the JDK 1.2 release.

wordWrap

public static java.lang.String[] wordWrap(java.lang.String msg,
                                          int widthInChars)
Word-wrap a string into an array of strings. Space is the only separator character recognized.

arrayToString

public static java.lang.String arrayToString(java.lang.String[] from,
                                             java.lang.String separator)
Convert an array of strings to a single line with elements separated by the given separator. Similar to Tcl's join.
Parameters:
from - the array of strings to convert
separator - the string to insert between each element

stringToArray

public static java.lang.String[] stringToArray(java.lang.String from,
                                               java.lang.String separator)
Convert a string of delimited strings to an array of strings. Similar to AWK's and Tcl's split.
Parameters:
from - the string to convert
separator - the delimiter

truncateFloat

public static java.lang.String truncateFloat(float f,
                                             int digits)
Truncate a float to the required number of significant digits.

addCommas

public static java.lang.String addCommas(float f)
Deprecated. Use standard java.* APIs which create the correct localized number format.

Add commas to a number for "123,456.7" style formatting.

addCommas

public static java.lang.String addCommas(java.lang.String numStr)
Deprecated. Use standard java.* APIs which create the correct localized number format.

Add commas to a number for "123,456.7" style formatting.

isSubclassOf

public static boolean isSubclassOf(java.lang.Class sub,
                                   java.lang.Class sup)
Deprecated. Use sup.isAssignableFrom(sub)

Test if a class is a subclass of another.

getSuperInterfaces

public static java.util.Set getSuperInterfaces(java.lang.ClassLoader cl,
                                               java.lang.String className,
                                               java.lang.String baseClassName)
                                        throws java.lang.ClassNotFoundException
Get all super-interfaces of a class, excluding the given base interface. Returns a set of strings containing class names.

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Class declaringClass,
                                                 java.lang.ClassLoader loader,
                                                 java.lang.String name,
                                                 java.lang.String[] paramClassNames)
                                          throws java.lang.Exception


Copyright � 2002 Macromedia Corporation. All Rights Reserved.