|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.util.Utility
public final class Utility
Handy class full of static functions.
| Constructor Summary | |
|---|---|
Utility()
|
|
| Method Summary | |
|---|---|
static int |
bytesToInt(byte[] array,
int offset)
Unmarshal a byte array to an integer. |
static long |
bytesToLong(byte[] array,
int offset)
Unmarshal a byte array to an long. |
static void |
checkJVMVersion()
|
static char[] |
convertByteArrayToCharArray(byte[] byteArray,
java.lang.String charset)
Convert the byte array to char array with respect to given charset. |
static byte[] |
convertCharArrayToByteArray(char[] charArray,
java.lang.String strCharset)
Convert the char array to byte array with respect to given charset. |
static java.lang.ClassLoader |
getClassLoader()
Get the current thread's context class loader which is set to the CommonClassLoader by ApplicationServer |
static java.lang.String |
getEnvOrProp(java.lang.String name)
Return the value for a given name from the System Properties or the Environmental Variables. |
static java.lang.String |
getLocalAddress()
Return the hostname of the local machine. |
static java.lang.String |
getLocalHost()
Return the hostname of the local machine. |
static java.util.Properties |
getPropertiesFromFile(java.lang.String file)
|
static void |
intToBytes(int value,
byte[] array,
int offset)
Marshal an integer to a byte array. |
static short |
intToShort(int value)
|
static void |
invokeApplicationMain(java.lang.Class mainClass,
java.lang.String[] args)
Verify and invoke main if present in the specified class. |
static void |
invokeSetMethod(java.lang.Object obj,
java.lang.String prop,
java.lang.String value)
|
static void |
invokeSetMethodCaseInsensitive(java.lang.Object obj,
java.lang.String prop,
java.lang.String value)
|
static java.lang.Class |
loadClass(java.lang.String className)
Loads the class with the common class loader. |
static void |
longToBytes(long value,
byte[] array,
int offset)
Marshal an long to a byte array. |
static java.rmi.Remote |
lookupObject(java.lang.String publishedName,
java.lang.Class anInterface)
This is a convenience method to lookup a remote object by name within the naming context. |
static java.lang.ClassLoader |
setContextClassLoader(java.lang.ClassLoader newClassLoader)
Utility routine for setting the context class loader. |
static void |
setEnvironment()
|
static int |
shortToInt(short value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utility()
| Method Detail |
|---|
public static void checkJVMVersion()
public static java.util.Properties getPropertiesFromFile(java.lang.String file)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getLocalHost()
public static java.lang.String getLocalAddress()
public static java.rmi.Remote lookupObject(java.lang.String publishedName,
java.lang.Class anInterface)
throws javax.naming.NamingException
javax.naming.NamingException - if the object with that
name could not be found.
public static int bytesToInt(byte[] array,
int offset)
array - The array of bytes.offset - The offset from which to start unmarshalling.
public static void intToBytes(int value,
byte[] array,
int offset)
array - The array of bytes.offset - The offset from which to start marshalling.
public static long bytesToLong(byte[] array,
int offset)
array - The array of bytes.offset - The offset from which to start unmarshalling.
public static void longToBytes(long value,
byte[] array,
int offset)
array - The array of bytes.offset - The offset from which to start marshalling.
public static void invokeApplicationMain(java.lang.Class mainClass,
java.lang.String[] args)
throws java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static void invokeSetMethod(java.lang.Object obj,
java.lang.String prop,
java.lang.String value)
throws java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
public static void invokeSetMethodCaseInsensitive(java.lang.Object obj,
java.lang.String prop,
java.lang.String value)
throws java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessExceptionpublic static short intToShort(int value)
public static int shortToInt(short value)
public static java.lang.ClassLoader getClassLoader()
public static java.lang.Class loadClass(java.lang.String className)
throws java.lang.ClassNotFoundException
className - the class name
if - the class is not found.
java.lang.ClassNotFoundExceptionpublic static java.lang.ClassLoader setContextClassLoader(java.lang.ClassLoader newClassLoader)
public static void setEnvironment()
public static java.lang.String getEnvOrProp(java.lang.String name)
name - - the name of the System Property or Environmental Variable
public static char[] convertByteArrayToCharArray(byte[] byteArray,
java.lang.String charset)
throws java.nio.charset.CharacterCodingException
byteArray - charset - null or "" means default charset
java.nio.charset.CharacterCodingException
public static byte[] convertCharArrayToByteArray(char[] charArray,
java.lang.String strCharset)
throws java.nio.charset.CharacterCodingException
charArray - strCharset - null or "" means default charset
java.nio.charset.CharacterCodingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||