Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mule.util
Class Utility  view Utility download Utility.java

java.lang.Object
  extended byorg.mule.util.Utility

public class Utility
extends java.lang.Object

Utility is a singleton grouping common functionality like converting java.lang.String to different data types, reading files, etc

Version:
$Revision: 1.8 $

Field Summary
private static org.apache.commons.logging.Log log
          logger used by this class
 
Constructor Summary
Utility()
           
 
Method Summary
static java.lang.Object byteArrayToObject(byte[] src)
           
static java.io.File createFile(java.lang.String filename)
           
static java.lang.String fileToString(java.lang.String fileName)
          Reads the incoming file and returns the content as a String object.
static java.lang.String formatTimeStamp(java.util.Date dateTime, java.lang.String format)
           
static boolean getBooleanProperty(java.util.HashMap props, java.lang.Object key, boolean defaultValue)
           
static boolean getBooleanValue(java.lang.String s)
          Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true".
static java.util.Date getDateFromString(java.lang.String date, java.lang.String format)
           
static java.util.Vector getDelimitedValueList(java.lang.String strValue, java.lang.String strDelim)
           
static double getDoubleProperty(java.util.HashMap props, java.lang.Object key, double defaultValue)
           
static java.sql.Timestamp getFormattedTimeStamp(java.lang.String date, java.lang.String timeStampFormat)
           
static int getIntProperty(java.util.HashMap props, java.lang.Object key, int defaultValue)
           
static long getLongProperty(java.util.HashMap props, java.lang.Object key, long defaultValue)
           
static java.lang.Object getProperty(java.util.HashMap props, java.lang.Object key, java.lang.Object defaultValue)
           
static java.lang.String getStringFromDate(java.util.Date date, java.lang.String format)
           
static java.lang.String getStringProperty(java.util.HashMap props, java.lang.Object key, java.lang.String defaultValue)
           
static java.lang.String getTimeStamp(java.lang.String format)
           
static java.io.File loadFile(java.lang.String filename)
           
static java.util.Properties loadProperties(java.lang.String fileName)
          This method reads the file in to a java.util.Properties object and returns it.
static byte[] objectToByteArray(java.lang.Object src)
           
static java.io.File openDirectory(java.lang.String directory)
           
static java.lang.String prepareWinFilename(java.lang.String filename)
           
static java.lang.String removeNamespacePrefix(java.lang.String eleName)
           
static java.lang.String replace(java.lang.String str, java.lang.String pattern, java.lang.String replace)
           
static java.lang.Class resolveClass(java.lang.String name)
           
static java.io.File stringToFile(java.lang.String filename, java.lang.String data)
          Reads the incoming String into a file at at the given destination.
static java.io.File stringToFile(java.lang.String filename, java.lang.String data, boolean append)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static transient org.apache.commons.logging.Log log
logger used by this class

Constructor Detail

Utility

public Utility()
Method Detail

createFile

public static java.io.File createFile(java.lang.String filename)
                               throws java.io.IOException

prepareWinFilename

public static java.lang.String prepareWinFilename(java.lang.String filename)

openDirectory

public static java.io.File openDirectory(java.lang.String directory)
                                  throws java.io.IOException

getBooleanValue

public static boolean getBooleanValue(java.lang.String s)
                               throws java.lang.Exception
Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true". Otherwise, throws an exception.


getTimeStamp

public static java.lang.String getTimeStamp(java.lang.String format)

formatTimeStamp

public static java.lang.String formatTimeStamp(java.util.Date dateTime,
                                               java.lang.String format)

fileToString

public static java.lang.String fileToString(java.lang.String fileName)
                                     throws java.io.IOException
Reads the incoming file and returns the content as a String object.


stringToFile

public static java.io.File stringToFile(java.lang.String filename,
                                        java.lang.String data)
                                 throws java.io.IOException
Reads the incoming String into a file at at the given destination.


stringToFile

public static java.io.File stringToFile(java.lang.String filename,
                                        java.lang.String data,
                                        boolean append)
                                 throws java.io.IOException

loadProperties

public static java.util.Properties loadProperties(java.lang.String fileName)
                                           throws java.lang.Exception
This method reads the file in to a java.util.Properties object and returns it.


getStringFromDate

public static java.lang.String getStringFromDate(java.util.Date date,
                                                 java.lang.String format)

getDateFromString

public static java.util.Date getDateFromString(java.lang.String date,
                                               java.lang.String format)

getFormattedTimeStamp

public static java.sql.Timestamp getFormattedTimeStamp(java.lang.String date,
                                                       java.lang.String timeStampFormat)

removeNamespacePrefix

public static java.lang.String removeNamespacePrefix(java.lang.String eleName)

loadFile

public static java.io.File loadFile(java.lang.String filename)
                             throws java.io.IOException

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String pattern,
                                       java.lang.String replace)

getDelimitedValueList

public static java.util.Vector getDelimitedValueList(java.lang.String strValue,
                                                     java.lang.String strDelim)

resolveClass

public static java.lang.Class resolveClass(java.lang.String name)
                                    throws java.lang.ClassNotFoundException

objectToByteArray

public static byte[] objectToByteArray(java.lang.Object src)
                                throws java.io.IOException

byteArrayToObject

public static java.lang.Object byteArrayToObject(byte[] src)
                                          throws java.io.IOException,
                                                 java.lang.ClassNotFoundException

getProperty

public static java.lang.Object getProperty(java.util.HashMap props,
                                           java.lang.Object key,
                                           java.lang.Object defaultValue)

getStringProperty

public static java.lang.String getStringProperty(java.util.HashMap props,
                                                 java.lang.Object key,
                                                 java.lang.String defaultValue)

getIntProperty

public static int getIntProperty(java.util.HashMap props,
                                 java.lang.Object key,
                                 int defaultValue)

getLongProperty

public static long getLongProperty(java.util.HashMap props,
                                   java.lang.Object key,
                                   long defaultValue)

getDoubleProperty

public static double getDoubleProperty(java.util.HashMap props,
                                       java.lang.Object key,
                                       double defaultValue)

getBooleanProperty

public static boolean getBooleanProperty(java.util.HashMap props,
                                         java.lang.Object key,
                                         boolean defaultValue)