jodd.util
Class Util

java.lang.Object
  extended byjodd.util.Util

public final class Util
extends java.lang.Object

General and System utilities.


Constructor Summary
Util()
           
 
Method Summary
static java.lang.Object cloneViaSerialization(java.io.Serializable obj)
          Create object copy using serialization mechanism.
static void copyPipe(java.io.InputStream in, java.io.OutputStream out, int bufSizeHint)
          Reads from input and writes read data to the output, until the stream end.
static boolean equals(java.lang.Object obj1, java.lang.Object obj2)
          Compare two objects just like "equals" would.
static java.lang.String exceptionToString(java.lang.Exception ex)
          Returns exception stack trace as a String.
static java.lang.StackTraceElement[] getStackTrace()
          Returns current stack trace not without this method in the trace.
static java.lang.Class loadClass(java.lang.String jarPath, java.lang.String type)
          Loads external or internal class.
static void notify(java.lang.Object obj)
          Notifies an object for synchronization purposes.
static void notifyAll(java.lang.Object obj)
          Notifies an object for synchronization purposes.
static void wait(java.lang.Object obj)
          Waits for a object for synchronization purposes.
static void wait(java.lang.Object obj, long timeout)
          Waits for a object or a timeout for synchronization purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

equals

public static boolean equals(java.lang.Object obj1,
                             java.lang.Object obj2)
Compare two objects just like "equals" would. Unlike Object.equals, this method allows any of the 2 objects to be null.

Parameters:
obj1 -
obj2 -
Returns:
true if equal, otherwise false

cloneViaSerialization

public static java.lang.Object cloneViaSerialization(java.io.Serializable obj)
                                              throws java.lang.Exception
Create object copy using serialization mechanism.

Parameters:
obj -
Returns:
cloned object
Throws:
java.lang.Exception

loadClass

public static java.lang.Class loadClass(java.lang.String jarPath,
                                        java.lang.String type)
                                 throws java.lang.ClassNotFoundException
Loads external or internal class. Class may exists in current virtual mashine, or it may be defined externally, as part of a jar.

Parameters:
jarPath - path to the jar file, or null
type - class type
Returns:
founded class, otherwise null
Throws:
java.lang.ClassNotFoundException

copyPipe

public static void copyPipe(java.io.InputStream in,
                            java.io.OutputStream out,
                            int bufSizeHint)
                     throws java.io.IOException
Reads from input and writes read data to the output, until the stream end.

Parameters:
in -
out -
bufSizeHint -
Throws:
java.io.IOException

getStackTrace

public static java.lang.StackTraceElement[] getStackTrace()
Returns current stack trace not without this method in the trace. Since an exception is thrown internally, this is a slow method.

Returns:
array of stack trace elements

exceptionToString

public static java.lang.String exceptionToString(java.lang.Exception ex)
Returns exception stack trace as a String.

Parameters:
ex - exception
Returns:
string of the exception

wait

public static void wait(java.lang.Object obj)
Waits for a object for synchronization purposes.

Parameters:
obj - object to wait for

wait

public static void wait(java.lang.Object obj,
                        long timeout)
Waits for a object or a timeout for synchronization purposes.

Parameters:
obj - object to wait for
timeout - the maximum time to wait in milliseconds

notify

public static void notify(java.lang.Object obj)
Notifies an object for synchronization purposes.

Parameters:
obj - object to notify

notifyAll

public static void notifyAll(java.lang.Object obj)
Notifies an object for synchronization purposes.

Parameters:
obj - object to notify


Jodd v0.24.5 Javadoc